8/26/2009
Fix: Bing Maps Mouse Wheel Bug in Firefox 3.5
Currently Firefox 3.5 is not supported by Bing Maps although there are only minor issues. One issue is that if your page is scrollable and you use the mouse wheel to zoom in or out of the map the page will also scroll. This is not very good for the user experience. After some investigation I have put together the following workaround to correct this issue:
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2"></script> <script type="text/javascript"> var map = null; function GetMap() { map = new VEMap('myMap'); map.LoadMap(); //Detect if browser is Firefox 3.5 if (navigator.userAgent.indexOf("Firefox/3.5") != -1) { document.getElementById("myMap").addEventListener('DOMMouseScroll', WindowMouseWheelHandler, false); } } function WindowMouseWheelHandler(e) { e.stopPropagation(); e.preventDefault(); e.cancelBubble = false; return false; } </script> </head> <body onload="GetMap();" style="font-family:Arial"> <div id='myMap' style="position:relative; width:600px; height:400px;"></div> <!-- Page filling div to make the page scrollable--> <div style="height:10000px"></div> </body> </html> |