I would like to zoom into the mouseposition with leaflet maps. Like a doubleclick on the map. Usually the zoom uses the center of the map, but I would like to zoom around the mousepos..
1 Answers
Per default the map behaves exactly as you want. The option scrollWheelZoom
is set to true
per default which means it will zoom in on the position of where your mouse is at that time. If you use 'scrollWheelZoom': 'center'
, it will zoom to the center of the current map bounds. 'scrollWheelZoom': false
will disable the scrollwheel entirely. See the documentation: http://leafletjs.com/reference.html#map-scrollwheelzoom
If your map behaves differently it must mean that your map's scrollWheelZoom
options is set to center
; But your saying 'usually' which i'm finding very curious since it would mean your map behaves differently everytime you zoom, that would be very odd.
Here's a Plunker demonstration of all three behaviors: http://plnkr.co/edit/ZhHqK9?p=preview

- 27,722
- 4
- 67
- 76