简体   繁体   中英

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? :)

this is my workaround for this problem:

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

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

in theory, you could do this:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM