4

I'm getting below error:

[cycle] terminating; too few slides: 1

Below is the code for jQuery Cycle. I'm not sure why this is coming out in 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
                }
            ); 

What could be wrong?

Jae Kun Choi
  • 2,011
  • 5
  • 25
  • 32

2 Answers2

4

actually this error comes when your sliding elements Less than 2. if you want to run cycle plugin in single element also then go to

jquery.cycle.all.js

and find

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

and change the condition limit to 1 like

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

if you don't want run single element then you should put condition on your language side that render element if elements count > 2

Cheers!

Mudassar Ali

1

It is something with your first line:

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

You are trying to create .cicle() inside a .cicle(). If you try:

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

It doesn't return any error.

samura
  • 4,375
  • 1
  • 19
  • 26