Skip Navigation

[Resolved] Prevent zoom on mobile map

This thread is resolved. Here is a description of the problem and solution.

Problem:
how to Prevent zoom on mobile on google map

Solution:
You try to use the Tooslet Maps JS API hook: js_event_wpv_addon_maps_init_map_completed

You can find the proposed solution, in this case, with the following reply:
https://toolset.com/forums/topic/prevent-zoom-on-mobile/#post-1234398

Relevant Documentation:
https://toolset.com/documentation/user-guides/programmatically-change-map-settings/#changing-settings-when-using-google-maps-api

This support ticket is created 5 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 2 replies, has 2 voices.

Last updated by Bob 5 years, 8 months ago.

Assisted by: Minesh.

Author
Posts
#1234323

Bob

Although I turned off zoom in my views, it is still possible to zoom on mobile and tablet using gestures. How do I prevent this behaviour?

hidden link

#1234398

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - what if you try to use the Tooslet Maps JS API hook: js_event_wpv_addon_maps_init_map_completed

For example:

jQuery(document).ready(function(){

$( document ).on('js_event_wpv_addon_maps_init_map_completed', function( event, event_settings ) {
    // Get the map using our .get_map() method
    var map = WPViews.view_addon_maps.get_map( event_settings.map_id );
    // Use Maps API .setOptions() method to programmatically change any option on the map.
    if ( map ) {
        map.setOptions({gestureHandling: 'greedy'});
    }
} );

});

You should try to add the suitable map option using above the hook that should help you to fix your issue, in your case zoop control.

More info:
=> https://toolset.com/documentation/user-guides/programmatically-change-map-settings/#changing-settings-when-using-google-maps-api
=> hidden link

#1234428

Bob

Setting 'gestureHandling' to 'none' did the trick. Thanks Minesh 🙂