Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var container = $('#fade'), images = container.find('img'), total = images.length, cur = 0, timeout = 4000;
- images.css("height", container.height()+"px").each(function(index) { // images must fit container
- if (index) $(this).hide(); // hide all images except 1st one (index==0)
- });
- setInterval(function() {
- $(images[cur]).fadeOut(function() { // fade out current image
- cur = ( cur==total-1 ) ? 0 : cur+1; // loop images count
- $(images[cur]).fadeIn(); // show next image
- });
- }, timeout); // configurable in var line
Advertisement
Add Comment
Please, Sign In to add comment