Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/raruto/leaflet-gesture-handling
- Owner: Raruto
- License: gpl-3.0
- Created: 2019-06-20T20:33:24.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-03-01T16:37:20.000Z (almost 2 years ago)
- Last Synced: 2024-11-09T08:47:28.474Z (2 months ago)
- Topics: fingers, gesture-handling, leaflet, maps, prevent, scroll, touch, zoom
- Language: JavaScript
- Homepage:
- Size: 441 KB
- Stars: 12
- Watchers: 3
- Forks: 7
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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)_
---
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)