Reputation: 180
Title explains it well.
I am using "Bing Maps AJAX Control, Version 7.0". I successfully disabled the mouse wheel from zooming in and out of the map. However, if I am hovering over a marker(pin) on the map, It still is zooming in and out.
Below is the code that I used to disabled the mouse wheel:
Microsoft.Maps.Events.addHandler(map, 'mousewheel', function(e) {
if(e.targetType == 'map') {
e.handled = true;
}
});
Upvotes: 2
Views: 3071
Reputation: 5308
For others that may come across this question that want to know how to completely disable zooming (i.e. via the scroll wheel or otherwise) in Bing Maps AJAX API v7, here's how:
var options = { credentials: 'put-your-credentials-here', **disableZooming: true**
}
map = new Microsoft.Maps.Map(document.getElementById('myMap'), options);
The Bing Maps API provides other MapOptions, as documented here.
Regarding @Mike Henken's problem:
However, if I am hovering over a marker(pin) on the map, It still is zooming in and out.
That appears to be a bug in Bing Maps v7 API that has been fixed as of 8/5/2013. I can no longer reproduce that problem.
Upvotes: 2
Reputation: 2571
The following code worked fine for me:
Microsoft.Maps.Events.addHandler(map, 'mousewheel', function(e) {
e.handled = true;
return true;
});
Upvotes: 5