madeyourday / contao-rocksolid-slider

RockSolid Slider Contao Extension
http://rocksolidthemes.com/de/contao/plugins/responsive-slider
Other
9 stars 7 forks source link

add autoplay pause button #93

Closed Fanni-Portier closed 3 months ago

Fanni-Portier commented 3 months ago

Is there a way to insert a button that can stop and start autoplay?

I need this feature for accessibility.

ausi commented 3 months ago

You can activate the pauseAutoplayOnHover option so that the autoplay is paused when the mouse cursor is placed over the slider.

Alternatively you can add a button that executes jQuery('#SLIDER_ID').data('rstSlider').pauseAutoplay(); and jQuery('#SLIDER_ID').data('rstSlider').playAutoplay(); on click.

Fanni-Portier commented 3 months ago

Muchas gracias!!!

Fanni-Portier commented 3 months ago

Sorry for asking again.

After you scroll back to a slider, autoplay is activated again. That's why I decided to use .stopAutoplay() instead of .pauseAutoplay(). Is there a way to reactivate autoplay after stopping it?

Or can I deactivate the functionality that autoplay is reactivated after scrolling?

ausi commented 3 months ago

That's why I decided to use .stopAutoplay() instead of .pauseAutoplay().

You should call .stopAutoplay(true) to make sure the autoplay does not restart automatically after the configured autoplayRestart delay.

Is there a way to reactivate autoplay after stopping it?

Yes, by calling .autoplay() or .autoplay(0).