开发者

moving back and forth div

Im trying to create some moving div, actually remake one, so that div would move endlessly back and forth, here is the script:

function animate(px) {
    $('.download').animate({
        'margin开发者_如何学JAVALeft' : "-10px"
    });
}

Thanks for help! ;)


Don't forget to add position: relative to the #download element before doing this:

var func = function() {
    $(".download").animate({"left": "-40px"}, 1000, function() { 
        $(this).animate({"left": "40px"}, 1000) 
    })

    setTimeout(func, 2000);
}

//Or remove setTimeout and use the following line instead:
//func(); setInterval(func, 2000);
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜