4

I've been trying to disable the mouse sroll-wheel scaling on my maps, but it doesn't seem to work (altough I'm pretty sure it used to work, maybe something changed).

Anyway, I have those custom infowindows that appear when users click on map markers and sometimes they have enough content that a scrollbar appears in them. I want to make sure that when people scroll, the content of the infowindow scrolls and that the map stays the same.

My code (coffeescript):

# Disable map Dragging when cursor enters infoBox div
$(document).on "mouseenter", ".infobox-content", () ->
  googleMap.setOptions( {draggable:false, scrollwheel:false} )

$(document).on "mouseleave", ".infobox-content", () ->
  googleMap.setOptions( {draggable:true, scrollwheel:true} )

I made sure that the events were fired when appropriate and that the events were properly set, but it still doesn't work.

Other similar questions that tell me to do exactly what I'm doing:

4

2 回答 2

2

这对我有用(FF,Chrome):

infowindow.open(map, marker);
$('.gm-style-iw').on('wheel', function (e) {
    e.stopPropagation();
});

每次调用时都应该绑定事件监听器infowindow.open();

于 2017-01-04T16:20:03.193 回答
0

我不知道这是否是解决方案,但它似乎已经解决了。

我没有指定 gem 版本,jquery-rails并注意到 jQuery 的版本现在是 1.9。在将版本指定为 之后~> 2.1.4,jQuery 现在被固定为 1.8,我的问题就消失了。

于 2013-01-22T15:06:50.973 回答