Pause or Continue the autoplay

⚠️ This article was created for developers!

To be able to follow the steps, you're required to have coding knowledge. If you're not a developer and can't achieve what you're looking for, consider hiring a developer.

Make sure to carefully follow the tutorial and write correct code. We're unable to provide help with custom coding, or the possible issues that are happening because of them.

The first thing you need to make the autoplay stop or continue is the ID of your slider. In this example I'll use 10 as the slider ID.

Stop the autoplay
_N2.r('#n2-ss-10', function(){
    _N2['#n2-ss-10'].pauseAutoplay();
});
Resume the autoplay
_N2.r('#n2-ss-10', function(){
    _N2['#n2-ss-10'].startAutoplay();
});
Example

This code assumes you have the Autostart enabled.

<div onclick="customAutoplay();">Click to stop or continue the autoplay</div>
<script>
var autoplayCounter = 0;
function customAutoplay(){
    _N2.r('#n2-ss-10', function(){
        if(autoplayCounter%2==0){
            _N2['#n2-ss-10'].pauseAutoplay();
        } else {
            _N2['#n2-ss-10'].startAutoplay();
        }
        autoplayCounter++;
    });
}
</script>
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.