Navigate to a new page at the last slide or after set number of loops

revAPI custom JavaScript to navigate to a link when the last slide is finished or after a set of slider loops.

To use the examples below, click here to learn how you can get your “revapi” name for your slider, and also learn where the custom JavaScript can be added.

Navigate to URL at last slide:

// change "revapi1" to whatever API name is being used for your slider 
// change the number "2000" to however many seconds you want to pass before the page changes once the last slide is shown 
var slider = revapi1.on('revolution.slide.onchange', function(e, data) { 

if(data.slideIndex === slider.revmaxslide()) { 

setTimeout(function() { 

window.location = 'http://www.yoursite.com/somepage/'; 

}, 2000); 

} 

}); 

Navigate to URL at last slide after a set amount of loops:

(function() { 

var loops = 0; 

// change "revapi1" to whatever API name is being used for your slider 
// change the number "2" in "loops === 2" to however many loops you want to pass before the page changes 
// change the number "2000" to however many seconds you want to pass before the page changes once the last slide is shown 
var slider = revapi1.on('revolution.slide.onchange', function(e, data) { 

if(data.slideIndex === slider.revmaxslide()) { 

loops++; 
if(loops === 2) { 

setTimeout(function() { 

window.location = 'http://www.yoursite.com/somepage/'; 

}, 2000); 

} 

} 

}); 

})(); 

Navigate to a new page at the last slide or after set number of loops

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.

If you need help with anything related to our plugin, please comment on a post or email me at [email protected].

Liked this Post?
Please Share it!