Skip to content

Instantly share code, notes, and snippets.

@kezabelle
Created February 19, 2013 10:48
Show Gist options
  • Save kezabelle/4984836 to your computer and use it in GitHub Desktop.
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 :(
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