cycle2 icon indicating copy to clipboard operation
cycle2 copied to clipboard

carousel.onDestroy method throws error

Open kennykaye opened this issue 11 years ago • 5 comments

Error: "Uncaught TypeError: Cannot call method 'remove' of undefined "

This issue occurs when destroying and initializing slideshows with different transitions, i.e.: carousel and fade.

Specifically, when the carousel plugin attempts to call the "remove" method on the "opts._carouselWrap" object, however under this specific circumstance, the carouselWrap object does not exist.

kennykaye avatar Dec 13 '13 01:12 kennykaye

Proposed fix:

On line 265 of jquery.carousel.js change:

    opts._carouselWrap.remove();

to

    if(opts._carouselWrap)
    {
        opts._carouselWrap.remove();
    }

kennykaye avatar Dec 13 '13 01:12 kennykaye

Yep, I'm running into the same thing. I'm swapping out the carousel with a grid of the images. I destroy the cycle and wrap the elements in a ul and LIs. if I resize the browser while in this grid, it somehow thinks the opts._carouselWrap is still in existence and starts throwing errors.

wlanni avatar May 15 '14 04:05 wlanni

Same problem, fix works, thx.

stevenMouret avatar Apr 13 '15 15:04 stevenMouret

Over 2 years later? This fix still works, with cycle2!

gaswirth avatar Sep 14 '15 03:09 gaswirth

Fix works. It's not in yet, so if you're having problems with destroying a carousel this is the way 👍

sbonardt avatar Dec 22 '16 09:12 sbonardt