Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Play/Pause Btn on Nivo Slider

Does anyone know if there is way to add Play/Pause button to Nivo slider?

Many thanks,

like image 814
jmysona Avatar asked Dec 04 '25 13:12

jmysona


1 Answers

Add the code below to your jquery ready function. The code adds two buttons for start and stop. The advantage of this code is that you don't have to modify the nivoslider.js. ;-)

var slider = jQuery('#slider');
var nivoStartStopControl = jQuery('<div class="nivo-startstopNav"></div>');

slider.after(nivoStartStopControl);
nivoStartStopControl.append('<a href="#" id="nivoStart"><span>START</span></a> <a href="#" id="nivoStop"><span>STOP</span></a>');

jQuery('#nivoStop').click( function(event) {
   event.preventDefault();
   slider.data('nivoslider').stop();
});

jQuery('#nivoStart').click( function(event) {
   event.preventDefault();
   slider.data('nivoslider').start();
});
like image 84
Tobi Avatar answered Dec 06 '25 06:12

Tobi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!