jsor / jcarousel

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

Button active/inactive state not setting properly #687

Closed ghulammustafa closed 10 years ago

ghulammustafa commented 10 years ago

The next and previous button state is set being correctly set on load.

In-case the jCarousel has only one-page, both the next and previous buttons should be set to inactive. However, the next button is not set as in-active. If you click on the next button an empty page is displayed. When you click the previous button, you return to the first (and only) page, and now the next button state is correctly set to inactive.

jsor commented 10 years ago

Can you please setup a reproducible test case.

ghulammustafa commented 10 years ago

The problem was that I was setting-up jcarousel on pageinit:

$(document).on("pageinit", "#wrapper", function(event) { $('.jcarousel').jcarousel(); ... });

Instead, when I used the wrapper code as in the Example samples, it worked. i.e.:

(function($) { $(function() { $('.jcarousel').jcarousel(); ... }); })(jQuery);