jQuery to control start time of Revolution Slider in WordPress

C

chrismitchell

Guest
Hi Guys,

I hope everyone is ok? Been extremely busy this year, hence not being about. I have a tricky question that I am looking for anyones help with. I'm hoping someone on here might be able to help me figure it out.

I have this site: http://362.a07.myftpupload.com/ The password is: aynhoe_park

I need to fix it so that the Revolution Sliders on each Section to only load when its scrolled onto. Can anyone suggest / give me some jQuery to force this to only start the sliders when the user is on the page with it. You will see that the site is a parallax and it has multiple sliders on the parallax.
I have tried this code below, from the people at Revolution Slider, which doesn't seem to work:


evapi5.on('revolution.slide.onloaded', function() {

// slider reaches top of screen
jQuery(this).waypoint(function(direction) {

// slider scrolled into view
if(direction === 'up') {
jQuery(this).revresume();
}

// slider scolled out of view
else {
jQuery(this).revpause();
}

}, {offset: function() {

return -jQuery(this).height();

// slider reaches bottom of screen
}}).waypoint(function(direction) {

// slider scrolled into view
if(direction === 'down') {
jQuery(this).revresume();
}

// slider scrolled out of view
else {
jQuery(this).revpause();
}

}, {offset: function() {

return jQuery(window).height();

}});
});
So If someone can help me out that would be great! As I would love just one bit of code not one for each slider to force it to run the slider only when it is in the screen, not before hand.

Thanks in advance.
 
Back
Top