找一个图片滚动脚本,可以设置一排几个小图片,点一下一次滚动一排,而不是滚动一个的

解决方案 »

  1.   

    参考:
    http://www.tripwiremagazine.com/2011/06/jquery-carousel.html
    http://www.tripwiremagazine.com/2010/11/60-excellent-jquery-image-sliders-and-tutorials.html
      

  2.   

    $(document).ready(function(){
    $(function(){ $('.Cont')
    .before('<div class="h"><img src="../images/jx_08.jpg" alt="PREV" class="prev" /></div>')
        .after('<div class="h"><img src="../images/jx_10.jpg" alt="NEXT" class="next" /></div>');
       var liLength = $('.rollBox li').length; var n = Math.floor(liLength / 6);
    var ul_width = Math.ceil(liLength /6) * 200;
    $('.rollBox ul').width(ul_width + 'px');
    var MaxLeft = 0;
    if(n>0){
    if(liLength % 6 == 0){
    MaxLeft = (n-1) * (-200);
    }else{
    MaxLeft = n*(-200);
    }
    }

       if(liLength >6){
    $('.next').css('cursor','pointer');
    }

    $('.next').click(function()
    {if($('.rollBox ul:animated').length)return false;var left=parseInt($('.rollBox ul ').css('left'),0);
    if(left==MaxLeft) return false;
    $('.rollBox ul').animate({ 
       'left':'-=200px'
      },500,function(){
      $('.prev').css('cursor','pointer');
    var left=parseInt($('.rollBox ul').css('left'),0);
    if(left==MaxLeft){
    $('.next').css('cursor','default');
    }
    });
    }); $('.prev').click(function()
    {if($('.rollBox ul:animated').length)return false;
    var left=parseInt($('.rollBox ul ').css('left'),10);
    if(left==0) return false;$('.rollBox ul').animate({'left':'+=200px'},500,function(){$('.next').css('cursor','pointer');
    var left=parseInt($('.rollBox ul ').css('left'),10);if(left==0){
    $('.prev').css('cursor','default');
    }
    });
    }
    );
    });
    });
      

  3.   

    唉,难道都只是jquery的?没有纯js?