jsor / jcarousel

Riding carousels with jQuery.
https://sorgalla.com/jcarousel/
MIT License
1.99k stars 736 forks source link

Pagination not restored on reload() #708

Closed cmcnaught closed 10 years ago

cmcnaught commented 10 years ago

Having modified the item list via Ajax/javascript, the pagination still retains the old number of items and doesn't update when list is scrolled after calling reload(). Is there a way to 'reload' the pagination?

jsor commented 10 years ago

Reproducible test case, please.

cmcnaught commented 10 years ago

Great product, I love it and the way it's put together. Here's a test case: http://www.cciwebs.com/development/carouseltest/ I based this on the basic carousel example in the download then added a button to replace the list with only images 4,5,6. After reload the images update to only 3, scroll works but the pagination breaks. Thanks, Colin

jsor commented 10 years ago

I can't open that page (times out).

cmcnaught commented 10 years ago

Must have been a temporary problem, works for me on Chrome36/IE11/Safari6/Firefox30 http://www.cciwebs.com/development/carouseltest/ Let me know, Colin

On Tue, Aug 19, 2014 at 8:42 AM, Jan Sorgalla notifications@github.com wrote:

I can't open that page (times out).

— Reply to this email directly or view it on GitHub https://github.com/jsor/jcarousel/issues/708#issuecomment-52627150.

jsor commented 10 years ago

Use this:

$("ul#testlist").html(newlist);
$('.jcarousel').jcarousel('reload');
$('.jcarousel-pagination').jcarouselPagination('reloadCarouselItems');
cmcnaught commented 10 years ago

Hi Jan, Sequence didn't work for me, required two clicks, However adding 'reloadCarouselItems' before the 'reload' worked fine. (See below and in test case): http://www.cciwebs.com/development/carouseltest/ Problem solved. Thanks, Colin

On Wed, Aug 20, 2014 at 12:38 AM, Jan Sorgalla notifications@github.com wrote:

Use this:

$("ul#testlist").html(newlist);$('.jcarousel').jcarousel('reload');$('.jcarousel-pagination').jcarouselPagination('reloadCarouselItems');

$("ul#testlist").html(newlist); $('.jcarousel-pagination').jcarouselPagination('reloadCarouselItems'); $('.jcarousel').jcarousel('reload');

— Reply to this email directly or view it on GitHub https://github.com/jsor/jcarousel/issues/708#issuecomment-52733262.

jsor commented 10 years ago

Yes, sorry, my bad.

sanchesfrolov commented 8 years ago

Hi Jan, Thanks for Jcarousel ! When you press the button pagination I upload new ellementy carousel and then reload carousel. This becomes the first active ellement. How can I make the active ellement which I pressed? I do so: .... if (products.length > 0){ var number = $(item).find('.active').text(); $(item).jcarouselPagination('reloadCarouselItems'); $('.jcarousel').jcarousel('reload'); $(item).find('.active').removeClass('active'); $(item).find('a:contains("' + number + '")').addClass('active');

       }

.... $(item) - it is the '.jcarousel-pagination' The desired ellement becomes active, but when I click on the following ellement pagination, currently active remains active ellement.