我已经加载了cycle2和cycle2 carousel插件,我试图让以下简单的演示工作:
HTML:
<div class="slideshow"
class="slideshow"
data-cycle-fx=carousel
data-cycle-timeout=1000 >
<img src="img/gallery/g1.jpg" alt="featured development project">
<img src="img/gallery/g2.jpg" alt="featured development project">
<img src="img/gallery/g3.jpg" alt="featured development project">
<img src="img/gallery/g1.jpg" alt="featured development project">
</div>
<a href="#" id="g-next">next</a>
<br><br><a href="#" id="g-prev">prev</a>
我已加载以下脚本:
<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="jquery.cycle2.js"></script>
<script src="jquery.cycle2.carousel.js"></script>
但我的演示现在仍然有用,为什么?我已经在演示页 HERE 上完全按照了什么,但仍然无法让循环插件工作。
答案 0 :(得分:1)
您必须初始化插件。我已经使用init更新了你的小提琴,它看起来像这样:https://jsfiddle.net/maffelu/efq5fw2s/1/
在javascript代码的末尾,您将看到初始化:
$(document).ready(function(){
$(".slideshow").cycle();
});