【jQuery】 jQuery上下飘动效果

jQuery实现图片上下飘动效果

function moveRocket() {
    $(".smallShip")
            //2000毫秒内top = top + 60;
            .animate({ 'top': '+=60' }, 2000)
            //停顿100毫秒
            .delay(100)
            //2000好秒内top = top - 60,注意:之后每100毫秒执行一次本函数
            .animate({ 'top': '-=60' }, 2000, function () {
                setTimeout(moveRocket, 100);
            });
};
moveRocket();

 

注意:之后每100毫秒执行一次本函数

 源:http://www.lanrenzhijia.com/pic/926.html

posted @ 2015-08-17 14:40  oiliu  阅读(275)  评论(0编辑  收藏  举报