Ray Lee
Ray Lee

Reputation: 197

How to disable single finger dragging on touch devices

When a user is dragging the page on mobile browsers, it acts like scrolling but when it comes to the map and the users finger is on the map, leaflet's dragging event is fired and scrolling is not.

I want to disable single finger dragging but keep double fingers dragging so that the user can drag the map with 2 fingers whilst scrolling the page with 1 finger.

Question: Is there any ways to do the above?

Upvotes: 11

Views: 9550

Answers (1)

Lorran Pegoretti
Lorran Pegoretti

Reputation: 146

Yes, there is. Just set dragging option to false and use tap option to keep scrolling up or down.

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

This should do what you want.

Upvotes: 13

Related Questions