试图制作旋转木马动画滑块

时间:2013-12-23 17:33:09

标签: javascript jquery json

我正在尝试创建一个旋转木马动画,拍摄3张照片并向左滑动并带来新的3张图片,我不认为我的方向正确需要帮助

这里是小提琴链接:http://jsfiddle.net/G5cKK/11/

setInterval(function () {
   $('img:first').animate({
        'left': -$('.box').width() + 'px'
    },1000,  function () {
            $(this).remove().appendTo('.all')
    });
}, 5000);

1 个答案:

答案 0 :(得分:0)

您可以为宽度而不是位置设置动画:

<强>的JavaScript

setInterval(function() {  
   var $img = $('img:first');
   var $imgClone = $img.clone().width(0).appendTo('.all');

   $img.animate({'width': 0},1000, function(){$img.remove()});
   $imgClone.animate({'width': 65},1000);
}, 5000)    

演示: http://jsfiddle.net/G5cKK/12/

相关问题