Moozoo
Moozoo

Reputation: 497

Nivo slider hide prev/next buttons if there is only one image

I was wondering if anyone who has had experience using the Jquery Nivo Slider knows if you can hide the previous/next buttons if the slider has only 1 image? The reason I'm using the slider is because I have a whole bunch of other images which load into the slider through pagination :P So I'm just wondering if this would be possible to do? :)

Upvotes: 1

Views: 7201

Answers (4)

user1668260
user1668260

Reputation: 27

jQuery(function($){
    if(jQuery('.nivoSlider').find('img').length>1){
        $('#slider').nivoSlider({
            effect: 'fade' // Specify sets like: 'fold,fade,sliceDown'
        });
    }
});

Upvotes: 1

monkey
monkey

Reputation: 21

Just ran into this today. Good luck folks.

Line #156 //This removes the control nav

if(settings.controlNav && vars.totalSlides > 1){

Line #320 //This stops the animation

if((!vars || vars.stop) && !nudge || vars.totalSlides == 1) return false;

Upvotes: 2

ShP
ShP

Reputation: 1143

this is my workaround for this problem:

if($('.nivoSlider').find('img').size()===1)
{
   $('.nivo-directionNav').remove();
}

Upvotes: 6

Joseph Marikle
Joseph Marikle

Reputation: 78520

in theory, you could do this:

if($(".nivoSlider").children().length === 1)
    $("nivo-prevNav, nivo-nextNav").hide(0);

Upvotes: 1

Related Questions