Hello! This video tutorial shows how to enable/disable mousewheel scrolling zoom in Google Map of WordPress templates.
You may have a Google Map at the bottom of the Home page of your WordPress template:
Hover over the map and try scrolling with your mouse wheel – you can see the map zooms in/out while scrolling.
You may want to disable this function since it is quite annoying at times, when you want to simply scroll the page up and have the map zooming out instead.
Otherwise, you may want to have zoom enabled so your site visitors could easily navigate to the desired location on the map by using mousewheel scrolling zoom.
Let’s learn how to manage this function.
The tutorial assumes you are already logged into your WordPress dashboard.
Navigate to Appearance -> Editor tab in the dashboard:
Click the static-map.php title on the right hand side to open the file for editing:
Now that the file editing interface is opened, use the CTRL+F/CMND+F key (Windows OS/Mac OS) to find the following piece of code:
You can see the following block of code below:
// How zoomed in you want the map to start at (always required) zoom: <?php echo of_get_option('zoom'); ?>, scrollwheel: true,
As you can see the scrollwheel function is set to “true” by default.
Simply replace it with “false” to disable the mousewheel scrolling so the code looks as follows:
// How zoomed in you want the map to start at (always required) zoom: <?php echo of_get_option('zoom'); ?>, scrollwheel: false,
Click the “Update File” button at the lower part of the screen to apply changes:
Navigate to your site front-end and refresh the page to see changes.
You can see the map mousewheel scrolling zoom is disabled now.
This is the end of the tutorial. You have learnt how to enable/disable mousewheel scrolling zoom in Google Map of your WordPress template.
Feel free to check the detailed video tutorial below: