Pause Nivo Slider

99封情书 提交于 2019-12-21 20:23:58

问题


I'd like to pause the Nivo slider for 5 seconds before it runs but show the first image. So I'll need to add some code in the property afterLoad I believe.

I've tried setTimout before running the slider code be it doesn't give the result I'd like.

Thanks in advanced!

Edit: Current Code

$(window).load(function(){
 $('#slider').nivoSlider({
     animSpeed: 500,
     pauseTime: 4000,
     effect : 'boxRain',
     directionNav : false,
     controlNav: false,
     afterLoad: function(){
         //$('#slider').data('nivoslider').stop();      
     }
 });
});

回答1:


I don't know your exact code but you could use .stop() on it and after 5 seconds you start it again. $('#slider').data('nivoslider').stop(); //Stop the Slider $('#slider').data('nivoslider').delay(5000).start(); //Start the Slider

Correction (because delay didn't work in that case):

$(window).load(function(){
  $('#slider').nivoSlider({
   animSpeed: 500,
   pauseTime: 4000,
   effect : 'boxRain',
   directionNav : false,
   controlNav: false,
  });
  jQuery('#slider').data('nivoslider').stop();
  setTimeout("jQuery(#slider').data('nivoslider').start()",5000);
});


来源:https://stackoverflow.com/questions/8135625/pause-nivo-slider

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!