2013-06-24 46 views
5

它只是沒有激活。我完全按照它在插件的演示頁面中複製代碼,是否有一些我錯過了的東西?Jquery循環2傳送帶不工作無控制檯錯誤

<div class="slideshow" 
    data-cycle-fx=carousel 
    data-cycle-timeout=0 
    data-cycle-carousel-visible=2 
    data-cycle-next="#next" 
    data-cycle-prev="#prev" 
    data-cycle-pager="#pager"> 
    <img src="http://jquery.malsup.com/cycle2/images/beach1.jpg"> 
    <img src="http://jquery.malsup.com/cycle2/images/beach2.jpg"> 
    <img src="http://jquery.malsup.com/cycle2/images/beach3.jpg"> 
    <img src="http://jquery.malsup.com/cycle2/images/beach4.jpg"> 
    <img src="http://jquery.malsup.com/cycle2/images/beach5.jpg"> 
    <img src="http://jquery.malsup.com/cycle2/images/beach6.jpg"> 
    <img src="http://jquery.malsup.com/cycle2/images/beach7.jpg"> 
    <img src="http://jquery.malsup.com/cycle2/images/beach8.jpg"> 
    <img src="http://jquery.malsup.com/cycle2/images/beach9.jpg"> 
</div> 

<div class=center> 
    <a href="#" id="prev">&lt;&lt; Prev </a> 
    <a href="#" id="next"> Next &gt;&gt; </a> 
</div> 

<div class="cycle-pager" id="pager"></div 

<script type="text/javascript" src="jquery-1.9.1.min.js?$staticlink$"></script> 

<!-- JS FILES TO BE INCLUDED--> 
<script type="text/javascript" src="anniversary/js/jquery.easing.1.3.js?$staticlink$"></script> 
<script type="text/javascript" src="anniversary/js/main.js?$staticlink$"></script> 
<script type="text/javascript" src="anniversary/js/jquery.cycle2.js?$staticlink$"></script> 
<script type="text/javascript" src="anniversary/js/jquery.cycle2.carousel.js?$staticlink$"></script> 

回答

8

,以自動激活滑塊或循環旋轉木馬,你必須使用默認的類名「週期幻燈片」否則,你必須聲明插件具有一流的尋找:

<script> 
    $.fn.cycle.defaults.autoSelector = [YOUR-CLASS-NAME]; //single or double quoted class without the square brackets 
</script> 

不要忘了用乾淨的代碼寫作。您在代碼中缺少一些封閉。

這是fiddle來顯示工作代碼。

+1

+1其工作。但是當我在瀏覽器中點擊「Ctrl + R」時它不工作 – Chandu