Created
February 19, 2013 10:48
-
-
Save kezabelle/4984836 to your computer and use it in GitHub Desktop.
Quick and dirty list item rotation (eg: for carousels), a reminder to myself. Can't remember where I found this :(
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
var rotate = function() { | |
$('.carousel ol').each(function(){ | |
var $cur = $(this).find('.current').removeClass('current'); | |
var $next = $cur.next().length?$cur.next():$(this).children().eq(0); | |
$next.addClass('current').trigger('change'); | |
}); | |
} | |
var interval = setInterval(rotate, 4000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment