Skip to content

Instantly share code, notes, and snippets.

@dannyconnolly
Created December 14, 2013 12:21
Show Gist options
  • Save dannyconnolly/7958569 to your computer and use it in GitHub Desktop.
Save dannyconnolly/7958569 to your computer and use it in GitHub Desktop.
Simple jquery loop for looping through elements and changing class
function gvi_slider(el, t, c) {
var $slides = $(el);
(function _loop(idx) {
$slides.removeClass(c).eq(idx).addClass(c);
setTimeout(function () {
_loop((idx + 1) % $slides.length);
}, t);
}(0));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment