我得到下面的错误:
循环终止;幻灯片太少:1
下面是jQuery周期的代码。我不知道为什么这会出现在Chrome上
var inners = $('ul#output li').cycle().cycle('stop');
var slideshow = $('ul#output').cycle({
fx: 'scrollHorz',
speed: 300,
timeout: 0,
startingSlide: 0,
before: function() {
// stop all inner slideshows
inners.cycle('stop');
// start the new slide's slideshow
$(this).cycle({
fx: 'fade',
timeout: 1000,
autostop: true,
end: function() {
// when inner slideshow ends, advance the outer slideshow
slideshow.cycle('next');
}
});
}
});
$.featureList(
$("#tabs li a"),
$("#output li"), {
start_item : 0
}
); 会出什么问题呢?
发布于 2014-06-03 15:58:15
实际上,当你的滑动元素少于2时,这个错误就出现了。如果你想在单个元素中运行循环插件,那么请转到
jquery.cycle.all.js
并找到
if (els.length < 2) {
log('terminating; too few slides: ' + els.length);
return;
}并将条件限制更改为1 like
if (els.length < 1) {
log('terminating; too few slides: ' + els.length);
return;
}如果您不想运行单个元素,那么您应该在语言方面设置条件,如果元素数大于2,则呈现元素
干杯!
穆达萨尔·阿里
发布于 2011-11-03 07:36:48
这是你的第一行中的内容:
var inners = $('ul#output li').cycle().cycle('stop');您正在尝试在.cicle()中创建.cicle()。如果你尝试:
var inners = $('ul#output').cycle().cycle('stop');它不会返回任何错误。
https://stackoverflow.com/questions/7988220
复制相似问题