basilio / responsiveCarousel

Simple carousel
MIT License
113 stars 64 forks source link

remove navigation when only 3 are shown on a visible 3 carousel? #22

Closed Riskbreaker closed 10 years ago

Riskbreaker commented 10 years ago

I have 2 carousels-

1 has 6 divs that works great with 3 showing and the next shows the 3 others.

On my other I only need to add 3... I know that I can add this so it wont do any carousel infinite: 'infinite: false'...

I know I can disable the carousel but this will be content driven..So is there a way to hide the 'crsl-nav' if only 3 or less are added in the carousel?

basilio commented 10 years ago

Hi @Riskbreaker, The plugin have some custom events to extend his behavior. For example, you could use initCarousel to set a condition for remove the associated navigation when the total items are less or equal than the visible items: http://pastie.org/8619124

$('#gallery').on('initCarousel', function(event, defaults, obj){
    if( defaults.total <= defaults.visible )
        $( '#'+defaults.navigation ).remove();
});

Check it out and tell me if this works for you Bye!

Riskbreaker commented 10 years ago

This should worked thanks!