jquery外掛程式jCarouselLite實現圖片無縫滾動

來源:互聯網
上載者:User
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>關於jquery外掛程式jCarouselLite的問題</title>
  6. <script src="jquery-1.2.6.pack.js" type="text/javascript"></script>
  7. <script src="jcarousellite_1.0.1.js" type="text/javascript"></script>
  8. <script type="text/javascript">
  9.    $(document).ready(function(){
  10.     $(".carousel").jCarouselLite({
  11.         auto:800,
  12.         speed:1000
  13.     });  
  14.    });
  15.    
  16. </script>
  17. <style type="text/css">
  18. body {
  19.     color:#000000;
  20.     font-family:verdana,sans-serif;
  21.     font-size:80%;
  22.     font-size-adjust:none;
  23.     font-style:normal;
  24.     font-variant:normal;
  25.     font-weight:normal;
  26.     letter-spacing:1px;
  27.     line-height:160%;
  28. }
  29. ul{
  30.     margin:0;
  31.     padding:0;
  32.     list-style-type:none;
  33. }
  34. .clear{
  35.     clear:both;
  36. }
  37. .carousel{
  38.     margin:0pt 0pt 20px 40px;
  39.     padding:10px 0pt 0pt;
  40.     position:relative;
  41. }
  42. .jCarouselLite{
  43.     background-color:#DFDFDF;
  44.     border:1px solid black;
  45.     float:left;
  46.     /* 官方有這段不知道有何用處,如果放進去就會顯示不了圖片了,js動態產生的值為何沒有替換掉 */
  47. /*  left:-5000px;
  48.     position:relative;
  49.     visibility:hidden;*/
  50. }
  51. .jCarouselLite li img{
  52.     background-color: #fff;
  53.     width: 150px;
  54.     height: 118px;
  55.     margin: 10px;
  56. }
  57. /* jCarouselLite 動態計算產生的css如下(用firebug查看的值) start */
  58. /*.jCarouselLite{
  59.     overflow: hidden; visibility: visible; position: relative; z-index: 2; left: 0px; width: 510px;
  60. }
  61. .jCarouselLite ul{
  62.     margin: 0pt; padding: 0pt; position: relative; list-style-type: none; z-index: 1; width: 2890px; left: -510px;
  63. }
  64. .jCarouselLite li{
  65.     overflow: hidden; float: left; width: 170px; height: 144px;
  66. }
  67. .jCarouselLite li img{
  68.     overflow:hidden;
  69. }
  70. *//* end */
  71. /* 最終想要的結果是是左邊按鈕-中間圖片-右邊按鈕,如果把外掛程式的js去掉,把上面注釋掉的css應用上去就是想要的結果 */
  72. </style>
  73. </head>
  74. <body>
  75. <div class="carousel">
  76.     
  77.     <div class="jCarouselLite">
  78.         <ul>
  79.             <li><img src="image/1.jpg" alt="" width="150" height="118" /></li>
  80.             <li><img src="image/2.jpg" alt="" width="150" height="118" /></li>
  81.             <li><img src="image/3.jpg" alt="" width="150" height="118" /></li>
  82.             <li><img src="image/4.jpg" alt="" width="150" height="118" /></li>
  83.             <li><img src="image/5.jpg" alt="" width="150" height="118" /></li>
  84.             <li><img src="image/6.jpg" alt="" width="150" height="118" /></li>
  85.         </ul>
  86.     </div>
  87.    
  88.     <div class="clear"></div>   
  89. </div>
  90. </body>
  91. </html>

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.