Created
April 17, 2014 15:46
-
-
Save edsykes/10993341 to your computer and use it in GitHub Desktop.
bootstrap 3 carousel step specific animations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(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