I am creating a slider using jquery animate function. The first image is moving to left and is working fine.But the next image is not quickly following the first image. It displays a blank screen for a while. This is what I have tried so far:
$('.next').live(开发者_开发问答'click',function() {
$('.ac_bgimage').animate({
left:"-80em"
}, 1500 , function(){
test();
});
});
function test() {
$('.ac_bgimage').attr('src','images/2.jpg');
$('.ac_bgimage').css('left','0em');
}
I am stuck at this point. Please help. Thanks in advance.
Try this easy slider jquery plugin. This will solve your purpose.
In your jsfiddle.net/cSVWv, you have two errors, because you have you div with 'next' class hidden, as thats is not possible to trigger the 'click' event. The other is, in image with 'ac_bgimage' class you need to the position relative to works.
See my example here: http://jsfiddle.net/expertCode/tvaMK/
精彩评论