B
B
blackbb2015-11-30 21:39:21
JavaScript
blackbb, 2015-11-30 21:39:21

How in leaflet.js to remove the response to the map when scrolling the page?

Hello, I have a map made with leaflet.js. The problem is that when scrolling the page with the mouse wheel, when you get to the map, it stops on it and changes the scale. How to make sure that when scrolling the page there is no reaction to the map?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stalker_RED, 2015-11-30
@blackbb

zoomControl: false Removes the zoom completely.
scrollWheelZoom: false - disables the wheel itself.
Can be enabled on focus or click.

map.on('click', function() {
  if (!map.scrollWheelZoom.enabled()) {
    map.scrollWheelZoom.enable();
  }
});
map.on('mouseout', function() {
  map.scrollWheelZoom.disable();
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question