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

前端 未结 11 1425
太阳男子
太阳男子 2020-12-13 23:46

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

相关标签:
11条回答
  • 2020-12-14 00:07

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

    0 讨论(0)
  • 2020-12-14 00:09

    we got this error when the carousel was in an iframe in an external site.

    none of the above answers helped and we only had a packed version of the jcarousel plugin. so we just did the following(along the lines of inmoon's answer):

    instead of "isNan" we replaced the "alert" keyword within the source code by a new function's name("myFunc"). then we created that function:

    myFunc = function(myParam) {return}
    

    this fixed the error.

    now i know this is a dirty hack, but it seemed to help

    0 讨论(0)
  • 2020-12-14 00:15

    just put "~/Content/Carouselcss/skin.css" at proper place.

    0 讨论(0)
  • 2020-12-14 00:15

    SOLUTION: Not sure if this is really a solution or workaround, but it does the job of stopping the nagging popup box once and for all (while permitting jCarousel functionality).

    1. Open jquery.jcarousel.pack.js in the ../jcarousel/lib/ directory.

    2. Seach for the word "alert" and you should find a snippet of code like this: Aborting|loop|infinite|an|cause|will|This|items|set|No|jCarousel|alert|class|

    3. Replace "alert" with "isNan": Aborting|loop|infinite|an|cause|will|This|items|set|No|jCarousel|isNan|class|

    4. Refresh the webpage that loads jCarousel and you should no longer get the infinite loop popup error!

    0 讨论(0)
  • 2020-12-14 00:22

    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

    0 讨论(0)
  • 2020-12-14 00:22

    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.

    0 讨论(0)
提交回复
热议问题