我在我的网站上使用flexSlider。我使用Slider with Carousel Slider作为导航。它不起作用,它给出了错误
"未捕获的TypeError:slider.slides.on不是函数"
在浏览器的控制台中。我不知道如何解决这个问题?
这是代码
<html>
<head>
<link rel="stylesheet" href="flexslider.css" type="text/css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script src="jquery.flexslider.js"></script>
</head>
<script>
$(window).load(function() {
// The slider being synced must be initialized first
$('#carousel').flexslider({
animation: "slide",
controlNav: false,
animationLoop: false,
slideshow: false,
itemWidth: 210,
itemMargin: 5,
asNavFor: '#slider'
});
$('#slider').flexslider({
animation: "slide",
controlNav: false,
animationLoop: false,
slideshow: false,
sync: "#carousel"
});
});
</script>
<div id="slider" class="flexslider">
<ul class="slides">
<li>
<img src="back1.jpg" />
</li>
<li>
<img src="back2.jpg" />
</li>
<li>
<img src="back3.jpg" />
</li>
<li>
<img src="back4.jpg" />
</li>
<!-- items mirrored twice, total of 12 -->
</ul>
</div>
<div id="carousel" class="flexslider">
<ul class="slides">
<li>
<img src="back1.jpg" />
</li>
<li>
<img src="back2.jpg" />
</li>
<li>
<img src="back3.jpg" />
</li>
<li>
<img src="back4.jpg" />
</li>
<!-- items mirrored twice, total of 12 -->
</ul>
</div>
</html>
答案 0 :(得分:1)
https://www.drupal.org/node/2401623 =&gt;我遇到了同样的错误。事实证明,最新的Flexslider库需要jQuery 1.7+。安装jQuery Update模块为我解决了这个问题。