Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reinitializing jcarousel #255

Closed
abhayastudios opened this issue Oct 12, 2011 · 1 comment
Closed

reinitializing jcarousel #255

abhayastudios opened this issue Oct 12, 2011 · 1 comment

Comments

@abhayastudios
Copy link

I am using jcarousel for displaying covers of photo albums and in a separate jcarousel the photos of the selected album. When I change albums however, the 'mess' of the previous album is still leftover and prevents the newly called instantiation of jcarousel to be properly displayed. In order to get it to work I have to run the following code before calling jcarousel again:

            // reset jcarousel plugin leftovers from previous instance
            if ($('#photocarousel').data('jcarousel'))
            {
                var ul = document.createElement('ul');
                $('#photocontainer').empty().append(ul); // delete old carousel and create new ul
                $("#photocontainer ul").attr("id", "photocarousel").attr("class", "jcarousel-skin-photos"); 
            }

Did I miss any existing support for this? Would it be possible to have something included in the mainstream version? I see on stackoverflow that there are many people struggling with this.

Thanks!

@jsor
Copy link
Owner

jsor commented Oct 14, 2011

You can only reset a carousel programmatically:

var carousel = $('#photocarousel').data('jcarousel');

// Clears the carousel
carousel.reset();

// Add items one by one
carousel.add('<div>Item</div>');
carousel.add('<div>Item</div>');

@jsor jsor closed this as completed Dec 27, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants