jQuery Cycle Plugin [循环]终止;幻灯片太少:1

时间:2011-11-02 22:43:46

标签: jquery jquery-cycle

我收到以下错误:

[循环]终止;幻灯片太少:1

以下是jQuery Cycle的代码。我不确定为什么这会在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
                }
            ); 

可能出现什么问题?

2 个答案:

答案 0 :(得分:3)

实际上,当您的滑动元素小于2时会出现此错误。 如果你想在单个元素中运行循环插件那么 转到

  

jquery.cycle.all.js

并找到

if (els.length < 2) {
            log('terminating; too few slides: ' + els.length);
            return;
        }

并将条件限制更改为1,如

if (els.length < 1) {
            log('terminating; too few slides: ' + els.length);
            return;
        }

如果你不想运行单个元素,那么你应该在你的语言方面加上条件 如果元素计数&gt;那个渲染元素2

干杯!

Mudassar Ali

答案 1 :(得分:1)

这是你的第一行:

var inners = $('ul#output li').cycle().cycle('stop');

您正尝试在.cicle()内创建.cicle()。如果您尝试:

var inners = $('ul#output').cycle().cycle('stop');

它不会返回任何错误。

相关问题