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?
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...
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
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:
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With