5

Unable to disable the default zooming on scroll functionality on Mapbox GL JS. Nothing in the API documentation sheds light on this. Even missing the scroll event in their docs.

var map = new mapboxgl.Map({
  container: 'map',
  style: 'mapbox://styles/mapbox/streets-v8',
  zoom: 15
});

2 Answers 2

11

Or in another way:

var map = new mapboxgl.Map({
    container: 'map',
    style: 'mapbox://styles/mapbox/streets-v8',
    zoom: 15,
    scrollZoom      : false,
    boxZoom         : false,
    doubleClickZoom : false
});
Sign up to request clarification or add additional context in comments.

1 Comment

In addition, use the "keyboard: false" option to disable the keyboard zoom with + / - keys
7

Inspected the map object, saw the scrollZoom and tried to call the disable. Great success!

map.scrollZoom.disable();

1 Comment

Deprecated. Use map.scrollWheelZoom.disable();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.