开发者

jquery animate slider onClick event

开发者 https://www.devze.com 2023-04-07 17:30 出处:网络
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

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/

0

精彩评论

暂无评论...
验证码 换一张
取 消