【问题标题】:Stop nivo slider effect when some conditions occurs发生某些情况时停止 nivo 滑块效果
【发布时间】:2013-03-19 21:09:59
【问题描述】:

我不想在聚焦最后一张图片时滑动 nivo 滑块。示例

$('#slider').nivoSlider({
    manualAdvance: true,
    beforeChange: function(){
        if(condition){
           //do not go to afterChange function
        }
    },
    afterChange: function(){

    }, 
});

我可以阻止滑块滑动吗?

【问题讨论】:

    标签: jquery nivo-slider


    【解决方案1】:

    NivoSlides 有两个函数来启动/停止滑块,如noted in its documentation.

    $('#slider').data('nivoslider').stop(); //停止滑块 $('#slider').data('nivoslider').start(); //启动滑块

    所以你可以试试这个:

    $('#slider').nivoSlider({
            manualAdvance: true,
            beforeChange: function(){
                if(condition){
                   $('#slider').data('nivoslider').stop();
                }
            },
            afterChange: function(){
    
            }, 
        });
    

    【讨论】:

      猜你喜欢
      • 2020-05-05
      • 1970-01-01
      • 1970-01-01
      • 2014-01-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多