Pause/Resume Slider on Scroll with jQuery WayPoints

This article is now outdated!

For version 5.0+, this can now be easily achieved with the “Stop Slider out of Viewport” option shown here.

jQuery WayPoints is a cool open-source script that allows you to detect when an HTML element scrolls into and out of the page’s view. For example, if you happen to have a slider at the top of your page, with lots of other content below it, if the user scrolls the page, and the slider scrolls out of view, we can use WayPoints to pause the slider. And likewise, if the user scrolls back to the top of the page, we can use WayPoints to resume the slider once the slider is scrolled back into view.

 

Slider Revolution 4.5 introduced a new “Custom JavaScript” section inside the slider’s main settings page:

waypoints_1

 

If you aren’t using version 4.5 or higher, click here for instructions about how to update the plugin.

 

To get started, download the WayPoints script. Once downloaded, inside the download source, upload the file named “waypoints.min.js” to your website using your favorite ftp program. A good place for it is to upload it inside the “wp-content” folder.

 

Next, add the waypoints script to your theme’s “header.php” file, directly before the closing “</head>” tag. Here’s an example:

 

Next, head over to your slider’s main settings page, and open the “API functions” section. This is where you can get your “revapi” name that’s specific to your slider. The “revapi” name is highlighted in the screenshot below. We’ll use this in our custom WayPoints script.

waypoints_2

 

Next, open the “CSS/JavaScript” option. We’ll be adding the WayPoints script to the “Custom JavaScript” section shown in the following screenshot:

waypoints_3

 

Next, paste the following code into the “Custom JavaScript” section. After pasting the code, change the “revapi3” part on the very first line to whatever “revapi” name is being used for your slider (see above for getting your “revapi” name). Read the code’s comments if you’re interested in learning about the script, and you can also check out the WayPoints documentation here.

 

 

waypoints_4

 

Finally, scroll back up the slider’s settings page a bit and save your changes:

waypoints_5