I have a big problem for mobile users:
i have a google maps that has width: 100%
and so when the user scroll the window if touch the screen "inside" the map, the scroll it will be only for map and not for all window... (yesterday my father for 3 minutes scrolled inside the map XD)
To scroll the window is possible touch the border of screen, but is very very scrict and not all users understand this.
I dont'want a map with a width
less of 100%
so i must found other solution...
This is it will be make the map draggable only when it is touch with two fingers, almost when pinch to zoom...
but which google maps event i can to use ?
maybe:
google.maps.event.addListener(map, 'dblclick', function(event){
this.setOptions({draggable:true});
});
but maybe at first click on map i should to alert (with a div in map) that is possible to move the map with two fingers ??
What do you think? and code is correct?
Thanks a lot and sorry for my english and for strange question :D
The two-finger scroll is a feature that can be applied to maps when in an iFrame. When two-finger scroll is enabled on a map that is contained in an iFrame the map will require two fingers to pan around the map - this is done to prevent maps from stopping a screen's regular scroll on mobile.
Just pinch-to-zoom, and you'll zoom in and out with ease in Google Maps. The second gesture is tapping twice on the display. Repeat the gesture until you reach the zoom level you desire. You'll have to pinch-to-zoom to zoom out.
If you are using API v3.27 or higher. While initializing map just add property gestureHandling: 'Cooperative'
like this
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 4,
center: myLatLng,
gestureHandling: 'cooperative'
});
More Info Here
Or if you want to do this after creating the map, do
map.setOptions({gestureHandling: 'cooperative'});
More Info Here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With