Skip to content

Instantly share code, notes, and snippets.

@skowron-line
Last active December 23, 2015 10:49
Show Gist options
  • Save skowron-line/6623808 to your computer and use it in GitHub Desktop.
Save skowron-line/6623808 to your computer and use it in GitHub Desktop.
jquery slider using toggle function. Example: http://jsfiddle.net/skowron_line/ch4g8/1/
var s = $('.slider'), i = 0;
setInterval(function(){
var o = $([]);
o = o.add(s[i]);
if(i === s.length - 1) {
i = -1;
}
i++;
o = o.add(s[i]);
o.toggle();
}, 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment