简体   繁体   English

试图使旋转木马动画滑块

[英]trying to make carousel animation slider

i am trying to creat a carousel animation that take 3 pics and slide the to the left and bring new 3 images, i don't think i'm in the right direction need help 我正在尝试制作一张轮播动画,该动画需要3张照片并将其滑动到左侧并带来3张新图像,我认为我没有朝正确的方向寻求帮助

here is the fiddle link: http://jsfiddle.net/G5cKK/11/ 这是小提琴链接: http : //jsfiddle.net/G5cKK/11/

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

You can animate width instead of position: 您可以设置宽度而不是位置的动画:

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM