Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No width/height set for items. This will cause an infinite loop. Aborting

I am using jcarousel, and on window resizing I am getting the error:

jCarousel: No width/height set for items. This will cause an infinite loop. Aborting...

How can I avoid this error?

like image 814
nirmal Avatar asked Sep 24 '10 07:09

nirmal


3 Answers

Just provide the option 'itemFallbackDimension'

Example:

jQuery('#yourcarousel').jcarousel({
    scroll: 1,
    visible: 1,
    animation: 3000,
    auto: 8,
    wrap: 'circular',
    itemFallbackDimension: 300
});

If, for some reason, jCarousel can not detect the width of an item, you can set a fallback dimension (width or height, depending on the orientation) here to ensure correct calculations.

I hope this helps someone...

like image 153
Christian Schulz Avatar answered Nov 05 '22 14:11

Christian Schulz


This error shows up when the css file bundled is not attached or not correctly attached ... you have to correctly apply it (the name of the skin goes into the id or the ul).
Example : the class of the ul must be set to jcarousel-skin-tango or to jcarousel-skin-ie7

like image 15
Khalil Khamlichi Avatar answered Nov 05 '22 13:11

Khalil Khamlichi


I've just encountered this problem and neither the above, nor any other solution I found fixed the problem. If anyone's still encountering this I fixed it as follows:

  1. Upgrade to latest version of jCarousel if not already on latest.
  2. Define the itemFallbackDimension property when you create your jCarousel instance, with it set to either the height or width, depending on whether you're using jCarousel in horizontal or vertical orientation, e.g:

    jQuery('#imageScroller').jcarousel({ scroll :1, itemFallbackDimension:588 });

Hopefully that will help you as it did me.

like image 10
Alistair Jackman Avatar answered Nov 05 '22 14:11

Alistair Jackman