Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/raruto/leaflet-gesture-handling

Leaflet plugin that allows to prevent default map scroll/touch behaviours
https://github.com/raruto/leaflet-gesture-handling

fingers gesture-handling leaflet maps prevent scroll touch zoom

Last synced: about 2 months ago
JSON representation

Leaflet plugin that allows to prevent default map scroll/touch behaviours

Awesome Lists containing this project

README

        

# leaflet-gesture-handling.js

A Leaflet plugin that allows to prevent default map scroll/touch behaviours.

_For a working example see [demo](https://raruto.github.io/leaflet-gesture-handling/examples/leaflet-gesture-handling.html)_


Ctrl + scroll to zoom the map

---



Initially based on the work of elmarquis


---

## How to use

1. **include CSS & JavaScript**
```html

...
html, body, #map { height: 100%; width: 100%; padding: 0; margin: 0; }






...

```
2. **choose the div container used for the slippy map**
```html

...


...

```
3. **create your first simple “leaflet-gesture-handling” slippy map**
```html

...
var map = new L.Map('map', {
center: [41.4583, 12.7059],
zoom: 5,
gestureHandling: true,
gestureHandlingOptions: { // OPTIONAL
// text: {
// touch: "Hey bro, use two fingers to move the map",
// scroll: "Hey bro, use ctrl + scroll to zoom the map",
// scrollMac: "Hey bro, use \u2318 + scroll to zoom the map"
// },
// locale: 'en', // set language of the warning message.
// duration: 5000 // set time in ms before the message should disappear.
}
});
...

```
_Related: [Leaflet-UI presets](https://github.com/raruto/leaflet-ui)_

---

**Compatibile with:** [email protected]

---

**Contributors:** [Elmarquis](https://github.com/elmarquis/Leaflet.GestureHandling), [Raruto](https://github.com/Raruto/leaflet-gesture-handling)