在我对css做一些修改之前!一切都很好,但是现在"carouFredSel“函数不断地重新加载页面(奇怪的行为)演示页面的url是http://demos.illucent.info/butts/index.html我想这是在脚本底部的某个地方,但我不知道到底是哪一个
<script type="text/javascript">
$(document).ready(function() {
$('#carousel1').carouFredSel({
align:"left",
width: '100%',
prev: '#prev1',
next: '#next1',
items : {
visible : 13,
width : "100%"
},
scroll : {
items : 2,
duration : 1500,
pauseDuration : 3500
}
});
$('#carousel2').carouFredSel({
align:"left",
width: '100%',
prev: '#prev2',
next: '#next2',
items : {
visible : 13,
width : "100%"
},
scroll : {
items : 2,
duration : 1500,
pauseDuration : 3500
}
});
$('#carousel3').carouFredSel({
align:"left",
width: '100%',
prev: '#prev3',
next: '#next3',
items : {
visible : 13,
width : "100%"
},
scroll : {
items : 2,
duration : 1500,
pauseDuration : 3500
}
});
//margins
$(".carousel img").css({"margin":"0px 0px 0px 5px"});
var items = $('.list_switch li a').each(function () {
$(this).click(function () {
//remove previous class and add it to clicked tab
items.removeClass('current');
$(this).addClass('current');
});
});
//hide all content divs and show current one
$('.wrapper').hide().eq(items.index($(this))).show('fast');
// resume the slide on the selected slider
$('.carousel').eq(items.index($(this))).trigger("play");
$('.carousel').eq(items.index($(this))).trigger("slideTo");
// select the first tab on page load
items[0].click();
});
</script>发布于 2012-07-29 04:52:50
我不认为这是因为CSS的变化。
在$(document).ready函数中,您将调用集合中名为“items”的第一个项目的单击事件。
items[0].click();items集合中的第一个元素是此超链接:
<a href="index.html">它将重定向到同一页面。当页面重新加载后,$(.ready)文档显然会再次运行,做同样的事情。
试着注释掉
items[0].click(); 你会发现它不再发生了。
https://stackoverflow.com/questions/11704173
复制相似问题