Scroll below slider when the last slide is shown

The following code snippet can be used to scroll below the slider automatically when the last slide is shown.

// the speed of the scrolling transition (ms)
var scrollTime = 500;
 
// the amount of time before the scrolling begins (ms)
var scrollDelay = 2000;
 
// change the "revapi1" part with your slider's ID
// https://tinyurl.com/zb6hzpc
var api = revapi1.on('revolution.slide.onchange', function(e, data) {
 
    if(data.slideIndex === api.revmaxslide()) {
 
        setTimeout(function() {
 
            var bounds = api[0].getBoundingClientRect();
            jQuery('html, body').animate({
                scrollTop: window.pageYOffset + bounds.top + bounds.height
            }, scrollTime);
 
        }, scrollDelay);
    }
}); 

Important Notice

Adjust the number “1” in the the “revapi1” part of the code for what your slider’s ID is.

Scroll below slider when the last slide is shown

The Author

KC

Strength does not come from winning. Your struggles develop your strengths. When you go through hardships and decide not to surrender, that is strength.

Liked this Post?
Please Share it!