簡體   English   中英

來回移動div

[英]moving back and forth div

我試圖創建一些移動的div,實際上重制一個,所以div將無休止地來回移動,這是腳本:

function animate(px) {
    $('.download').animate({
        'marginLeft' : "-10px"
    });
}

感謝幫助! ;)

在執行此操作之前,不要忘記添加position: relative對於#download元素:

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);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM