Search code examples
javascriptjqueryjcarousel

jCarousel next and prev button, disable?


Im using http://sorgalla.com/projects/jcarousel/ as a slider.... It shows one image at a time, and a total of four images... When displaying the first image, i dont want the prev arrow to be visible, and the same if im at number 4 image, i dont want the next arrow to be visible...

How do i do this?

I initialize the script like this:

jQuery(document).ready(function() {
                                jQuery('#mycarousel').jcarousel();
                            });

Solution

  • You can use CSS to hide the arrows. Adding the disabled classes is handled by the plugin itself.

    .jcarousel-prev-disabled, .jcarousel-next-disabled
    {
        visibility:hidden;
    }
    

    Demo: http://jsfiddle.net/ubanC/88/