Tagged: enfold, GMaps, googlemaps
Hello,
i want to enable the Mouse in my embedded google maps, that i can zoom in and out with my mousewheel.
Is there any quick solution for this?
Greets
Soehnke
Hey Soehnke,
Thank you for the inquiry.
According to the documentation, you can set the gestureHandling parameter of the map to “greedy” to allow any gestures (e.g touch, pan, pinch, scroll). Unfortunately, the documentation did not specify if this will also include the mousewheel.
Try to add this script in the functions.php file.
function ava_custom_script_map_params(){
?>
<script>
window.addEventListener('DOMContentLoaded', () => {
window.av_google_map.av_gmap_0.gestureHandling = "greedy";
window.av_google_map.av_gmap_0.scrollwheel = true;
});
</script>
<?php
}
add_action('wp_footer', 'ava_custom_script_map_params', 9999);
Default value of the gestureHandling parameter is “cooperative”.
UPDATE: There is actually a scrollwheel option. We added it above and set it to true.
Best regards,
Ismael
Perfekt! Works fine. You can close this Thread.
Hi,
Alright. But please note that the modification above will only work for the first map in the page. If you have multiple maps in the page, only the first map will be scrollable with the mousewheel. Please feel free to open another thread if you need anything else.
Have a nice day.
Best regards,
Ismael