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

nirmal picture nirmal · Sep 24, 2010 · Viewed 50.2k times · Source

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?

Answer

Christian Schulz picture Christian Schulz · May 5, 2011

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...