Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Crossfade' for text or transparent BG data and default to using children elements as the data source... #18

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 69 additions & 2 deletions agile_carousel.alpha.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
control_set_2: "",
control_set_3: "",
control_set_4: "",
control_set_5: ""
control_set_5: "",
elements_container: "",
};

options = $.extend(defaults, options);
Expand Down Expand Up @@ -84,6 +85,19 @@
var timer_data = "";
var ac_timer = "";

// Data from source elements?
if (!carousel_data) {
carousel_data = [];

// Get the children as the data elements and remove from the container
var cont = $(this);
cont.children().each(function(i,ele) {
ele = $(ele);
carousel_data[i] = {content: ele.wrap('<div>').parent().html()};
ele.remove();
});
}

// get the number of slides
$.each(carousel_data, function (key, value) {
number_of_slides++;
Expand Down Expand Up @@ -754,7 +768,60 @@



} // if transition type is slide
} // if transition type is fade

/////////////////////////////////
/////////////////////////////////
///// Fade Transition - 1 slide visible
/////////////////////////////////
/////////////////////////////////
if (transition_type == "crossfade" && number_slides_visible == 1) {

//if(trigger_type == "ac_hover"){
//ac_slides.stop();
//}
// change slide position
// rest of the slides
ac_slides.not(current_slide, next_slide).css({
"top": "-5000px",
"left": 0,
"z-index": 0,
"opacity": 0
});

// next slide
if (button_action) {
next_slide.css({
"top": 0,
"left": 0,
"z-index": 20
});

// current slide
current_slide.css({
"z-index": 10,
"opacity": 1
});


} // if
// animate slides
next_slide.stop().animate({
"opacity": 1
}, {
duration: transition_time,
complete: fade_complete
});
current_slide.stop().animate({
"opacity": 0
}, {
duration: transition_time,
complete: fade_complete
});


} // if transition type is crossfade

} // if current slide is not the next slide
} // if slide button is not disabled && transition complete

Expand Down