How To Alter Local Scroll Speed

In version 2.0.0 I added the local scroll speed to the theme’s primary localized data so you can easily tweak the speed (default is 1000ms).

Total’s wp_localize data

To understand how it works you must look at the wp_localize function in WordPress. This function basically lets you define variables for use with your jQuery/Javascript functions. Below is a screenshot of the theme’s current wp_localize data.


As you can see its a standard array with keys and values. What this does is output something like the following into the source code so we can use the variables (the array keys) in your javascript:


Altering The Local Scroll Speed

Now to alter the speed is very simple, if you noticed the array data above (in the dark screenshot) has the ‘wpex_localize_array’ filter added to it so via a child theme we can easily hook into that filter to alter anything! Below is the code you would add to your child theme’s functions.php file to alter the local scroll speed.