Search code examples
jquerycenterjcarousel

jCarousel center the active item


Is it possible to center the active item in jCarousel and give the active item a class name?

[http://jsfiddle.net/609w5gkL/][1]

In the documantion is standing 'center:true' but thats not working for me...


Solution

  • Duplicate question: jcarousel custom class on current slide

    You you need to pass in the "center:true" option underneath the first option you already have when you initialize jCarousel. I've added the option and now they are centered.

    jQuery('.slider').jcarousel({
        wrap: 'both',
        center: true
    });
    

    I've updated the code for you to add an "active" class too using the example link above. You may wish to clean up the code a bit yourself.

    Before you ask a question on Stack - do a quick search on here first. Chances are someones already answered the question you have.

    Here is an updated fiddle which adds your requests:

    http://jsfiddle.net/609w5gkL/2/