问题
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