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

Already on GitHub? Sign in to your account

reinitializing jcarousel #255

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

Comments

Projects
None yet
2 participants

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!

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 Dec 27, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment