Skip to content

Instantly share code, notes, and snippets.

@edsykes
Created April 17, 2014 15:46
Show Gist options
  • Save edsykes/10993341 to your computer and use it in GitHub Desktop.
Save edsykes/10993341 to your computer and use it in GitHub Desktop.
bootstrap 3 carousel step specific animations
$(document).ready(function() {
var timings = [6000, 4000, 4000, 4000, 4000, 4000];
var index = 0;
var animate = true;
var nextAnimation = function(timings) {
if (animate) {
$('.right.carousel-control').click();
}
debug("staying on step " + index + " for " + timings[index]);
setTimeout(nextAnimation, timings[index], timings);
}
debug("staying on step " + index + " for " + timings[index]);
setTimeout(nextAnimation, timings[index], timings);
$('.carousel')
.mouseover(function() {
animate = false;
debug("animate false");
})
.mouseleave(function() {
animate = true;
debug("animate true");
});
$('.left.carousel-control').click(function() {
index -= 1;
index = index % timings.length;
index = Math.abs(index);
debug(index);
});
$('.right.carousel-control').click(function() {
console.log("moving from " + index);
index += 1;
index = index % timings.length;
debug("to " + index);
})
$('#myCarousel').on('slid.bs.carousel', function (data, other) {
console.log('check check');
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment