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
});
答案 0 :(得分:5)
Inspected the map object, saw the scrollZoom
and tried to call the disable. Great success!
map.scrollZoom.disable();
答案 1 :(得分:2)
或以另一种方式:
var map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/mapbox/streets-v8',
zoom: 15,
scrollZoom : false,
boxZoom : false,
doubleClickZoom : false
});