jsor/jcarousel — Issue #255: reinitializing jcarousel
Author: joni78
Created: 2011-10-12 02:49:24+00:00
State: open

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!