Skip to content

Instantly share code, notes, and snippets.

@codepunkt
Created June 1, 2011 18:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codepunkt/1002918 to your computer and use it in GitHub Desktop.
Save codepunkt/1002918 to your computer and use it in GitHub Desktop.
jQuery - Bannerrotation, zufällig
$(function() {
var images = $('#banner').children();
images.filter(':eq(' + ~~(Math.random() * images.hide().length) + ')').show();
setInterval(function() {
var current = images.filter(':visible').fadeOut(),
next = (current.next().length ? current.next() : images.eq(0)).fadeIn();
}, 2000);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment