开发者

jquery - how do i make a div slide left 100px everytime i click a link

What i have so far is this

$(function(){
    $("#click").click(function(){
        $("#slide").animate(开发者_开发知识库{marginLeft:'100px'},'slow');                  
    });            
});

Heres a link to a demo

Which works only once, but if i try to click the link again, Nothing happens

how do I make it so it works more like a slideshow? so everytime I click, it slides left


Something like this. You use += expression:

$(function(){
    $("#click").click(function(){
        $("#slide").animate({left:'+=100px'},'slow');                  
    });            
});
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜