How to disable the transfer of one finger on touch devices

When a user drags a page in mobile browsers, it acts like a scroll, but when it comes to the map and the user’s finger is inside the map, the leaf drag event is triggered, but the scroll is not. We want to disable the drag of one finger, but drag the double fingers so that the user can drag the map with two fingers, scrolling the page with one finger. Question: Are there any ways to do this above?

+5
source share
1 answer

Yes there is. Just set the drag parameter to false and use the tap option to continue scrolling up or down.

var oMap = new L.Map('Map', { '...Other options...' dragging: false, tap: false }); 

This should do what you want.

+3
source

Source: https://habr.com/ru/post/1264362/


All Articles