javascript - How to disable mouse scroll over markers in Bing Maps v7 - Stack Overflow

Title explains it well.I am using "Bing Maps AJAX Control, Version 7.0". I successfully disab

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;
  }
});

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;
  }
});
Share Improve this question edited Dec 10, 2013 at 7:38 Kara 6,22616 gold badges53 silver badges58 bronze badges asked Apr 26, 2012 at 21:16 Mike HenkenMike Henken 1801 silver badge8 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 5

The following code worked fine for me:

Microsoft.Maps.Events.addHandler(map, 'mousewheel', function(e) {
    e.handled = true;
    return true;
});

For others that may e across this question that want to know how to pletely 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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745480380a4629530.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信