gpt4 book ai didi

javascript - 对象 # 没有方法 'carouFredSel'
转载 作者:行者123 更新时间:2023-11-30 09:01:41 27 4
gpt4 key购买 nike

我已经实现了一个可以正常工作的无限轮播,但我现在收到以下错误消息

对象 # 没有方法 'carouFredSel'

我已经为现在可以使用的菜单编辑了一些代码,但也许这两个脚本之间存在冲突?

http://www.ogormanconstruction.co.uk/basingstoke-treatment-works

Javascript:

<script type="text/javascript">
jQuery(document).ready(function() {
var imgLength = jQuery('ul#fredsel img').length;
jQuery('#totalImg').html(imgLength);
jQuery('#imgCount').html(1);

// Using custom configuration
// Using custom configuration
jQuery("#fredsel").carouFredSel({
items: 1,
align: false,
auto: false,
width: 1500,
scroll : {
items : 1,
duration : 1000,
pauseDuration : 2000
},
prev: {
button : "a.prev-slide",
onBefore : function() {
var theCount = parseInt(jQuery('#imgCount').html());
if (theCount === 1){
var theLength = jQuery('ul#fredsel img').length;
jQuery('#imgCount').html(theLength);
} else {
jQuery('#imgCount').html(theCount-1);
};
},
},
next: {
button : "a.next-slide",
onBefore : function() {
var theLength = jQuery('ul#fredsel img').length;
var theCount = parseInt(jQuery('#imgCount').html());
if (theCount === theLength){
jQuery('#imgCount').html(1);
} else {
jQuery('#imgCount').html(theCount+1);
};
},
}
})
.find("li").click(function() {
jQuery("#fredsel").trigger("slideTo", [jQuery(this)]);
}).css("cursor", "pointer")

});

</script>

CSS:

<div class="infinite-carousel">
<ul id="fredsel">
<li style="width: 600px"><img src="/wp-content/themes/child/images/basingstoke/basingstoke-1.png"></li>
<li style="width: 600px"><img src="/wp-content/themes/child/images/basingstoke/basingstoke-2.png"></li>
<li style="width: 600px"><img src="/wp-content/themes/child/images/basingstoke/basingstoke-3.png"></li>
<li style="width: 600px"><img src="/wp-content/themes/child/images/basingstoke/basingstoke-4.png"></li>
<li style="width: 600px"><img src="/wp-content/themes/child/images/basingstoke/basingstoke-5.png"></li>
<li style="width: 600px"><img src="/wp-content/themes/child/images/basingstoke/basingstoke-6.png"></li>
<li style="width: 600px"><img src="/wp-content/themes/child/images/basingstoke/basingstoke-7.png"></li>
</ul>
</div>

<div class="controls">
<a href="#" class="prev-slide"></a>
<a href="#" class="next-slide"></a>
</div>

最佳答案

看来您要多次添加 jQuery(以及其他脚本),carouFredSel 被覆盖了。

关于javascript - 对象 #<Object> 没有方法 'carouFredSel',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8732253/

27 4 0