问题:
I am using Google Maps API (v3) to draw a few maps on a page. 我正在使用Google Maps API(v3)在页面上绘制一些地图。 One thing I'd like to do is disable zooming when you scroll the mouse wheel over the map, but I'm unsure how. 我想做的一件事是在地图上滚动鼠标滚轮时禁用缩放,但我不确定如何。
I have disabled the scaleControl (ie removed the scaling UI element), but this doesn't prevent scroll wheel scaling. 我已禁用scaleControl(即删除了缩放UI元素),但这不会阻止滚轮缩放。
Here is part of my function (it's a simple jQuery plugin): 这是我的函数的一部分(它是一个简单的jQuery插件):
$.fn.showMap = function(options, addr){
options = $.extend({
navigationControl: false,
mapTypeControl: false,
scaleControl: false,
draggable: false,
mapTypeId: google.maps.MapTypeId.ROADMAP
}, options);
var map = new google.maps.Map(document.getElementById($(this).attr('id')), options);
// Code cut from this example as not relevant
};
解决方案:
参考一: https://stackoom.com/question/9mBp/如何使用Google-Maps-API禁用鼠标滚轮缩放参考二: https://oldbug.net/q/9mBp/How-to-disable-mouse-scroll-wheel-scaling-with-Google-Maps-API
来源:oschina
链接:https://my.oschina.net/u/3797416/blog/4283550