2012-06-14 62 views
0

我想让图像(和/或单幅广告图像)以一种幻灯片形式从右向左缓慢移动,然后在鼠标悬停时暂停。我也想要有左右箭头来改变点击幻灯片的方向。我不确定这是叫什么或如何去做。如何让div滚动从右到左jQuery动画?

请帮忙。谢谢。

+0

我有一种感觉,这个问题将不要和社区一起过得很好 – Huangism

+0

我只想知道它叫什么,所以我可以找到插件/代码。 – user1272372

+0

谷歌“jquery画廊旋转器” – Huangism

回答

0

使用scrollLeft来向左或向右滚动 没有太多与当前的问题,但一定会帮助其他用户..

 $(document).ready(function() { 

    // Creating two Left Right Scroll Button through JQuery 
     var btnRht= $("<input type='button' id='btnLeft' value='>>' class='ButtonStyle' width='5px' />"); 
    var btnLeft = $("<input type='button' id='btnRight' value='<<' class='ButtonStyle' />"); 
      // appending buttons to a td inside a html div 
     $('#tdDoE').append(btnLeft); 
    $('#tdDoE').append(btnRht); 
    // Left/Rht Scroll scroll  
       $("#btnLeft").click(function() { 
       var leftPos = $('.DivDataMain').scrollLeft(); 
       $(".DivDataMain").animate({scrollLeft: leftPos + 250}, 600); 
       }); 
        $("#btnRight").click(function() { 

       var leftPos2 = $('.DivDataMain').scrollLeft(); 
       $(".DivDataMain").animate({scrollLeft: leftPos2 - 250}, 600); 
       }); 

    }); 

HTML代码: -

 <div style="width: 300px; overflow: hidden;" class="DivDataMain"> 
     <table> 
      <tr> 
       <td id="tdDoE"> 
         Scroll Buttons will be appended after this text. 
       </td> 
      </tr> 
     </table> 
    </div>