2012-12-04 76 views
2

我想使用jQuery循環插件幻燈片圖像, ,但它不工作。如何使它可以運行。使用jQuery循環插件幻燈片圖像

附送腳本

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> 
    <script src="https://malsup.github.com/jquery.cycle.all.js"></script>  

CSS:

.pics { 
      height: 232px; 
      width: 232px; 
      padding: 0; 
      margin: 0; 
     } 

     .pics img { 
      padding: 15px; 
      border: 1px solid #ccc; 
      background-color: #eee; 
      width: 200px; 
      height: 200px; 
      top: 0; 
      left: 0 
     } 

腳本:

$(function(){ 
     $('.pics').cycle('fade'); 
    });​ 

產品圖股利

  <div class="pics"> 
       <img src="http://davealger.info/i/1.jpg" width="200" height="200" /> 
       <img src="http://davealger.info/i/2.bmp" width="200" height="200" /> 
       <img src="http://davealger.info/i/3.png" width="200" height="200" /> 
      </div> 

回答

2

變化https://malsup.github.com/jquery.cycle.all.jshttp:// - 或者更好的是,下載該插件和饒他可憐的服務器。 Google使用大容量的CDN;他沒有。

http://jsfiddle.net/mblase75/ZSJqh/

+0

下載jquery.cycle.all.js然後也不顯示幻燈片放映。圖像顯示爲列表 – xrcwrn

+0

如果圖像顯示爲列表,則jQuery Cycle插件由於某種原因未加載。檢查您的控制檯並仔細檢查是否正在加載文件,並按正確的順序。 – Blazemonger

+0

它正確加載我登記谷歌瀏覽器 – xrcwrn

1

如果在不下載腳本在本地設置,然後跟上最新的。

  1. Cycle.js被移動。
  2. 不要使用http://或https://

在這裏,這是從該網站的演示採取和編輯一點點:

<!-- include jQuery library --> 
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script> 
<!-- include Cycle plugin --> 
<script type="text/javascript" src="//cloud.github.com/downloads/malsup/cycle/jquery.cycle.all.latest.js"></script> 
<script type="text/javascript"> 
$(document).ready(function() { 
    $('.slideshow').cycle({ 
     fx: 'fade' 
    }); 
}); 
</script> 

注意,週期的位置.js
查看演示的源代碼是值得的。

+0

我已經下載並從我的文件夾鏈接到它的工作。問題只是沒有鏈接jquery.cycle.all.latest.js文件 – xrcwrn

+0

鏈接腳本是必不可少的。使用本地文件可以提高性能和加載時間。 – bobthyasian