automatic thumbnail slider using jquery : cannot add animation effects
i am trying to make an automatic image slider using jquery. i'm using an unordered list as the source of images. i used the basi开发者_StackOverflow中文版c logic that after a certain delay each
here is my code function rotate_images() { var i=1;
var _rotate = function() {
setTimeout(function() { var li=$('#li'+i); $('#li'+i).animate({'display':'none'},1000,'swing',function(){$(this).remove();}); if(i<5)
{
i++;
_rotate();
}
else
{
i=1;
_rotate();
}
},2000);
}; _rotate(); }
I highly recommend the jquery cycle plugin to accomplish this:
http://jquery.malsup.com/cycle/
Just tell it the parent object and you can customize how it works and use easing effects etc..
精彩评论