简体   繁体   English

Nivo滑块如果只有一张图像,则隐藏上一个/下一个按钮

[英]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? 我想知道是否有使用过Jquery Nivo Slider的经验的人知道,如果滑块只有1张图像,是否可以隐藏上一个/下一个按钮? 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? 我使用滑块的原因是因为我有一堆其他图像通过分页加载到滑块中:P所以我只是想知道这是否有可能吗? :) :)

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 Line#156 //这删除了控件导航

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

Line #320 //This stops the animation Line#320 //停止动画

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);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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