Ruby on rails gmaps4rails上的Infowindow关闭事件侦听器
我有一些标记列表显示在谷歌地图上。现在我想在关闭信息窗口时做一些额外的事情Ruby on rails gmaps4rails上的Infowindow关闭事件侦听器,ruby-on-rails,google-maps,gmaps4rails,Ruby On Rails,Google Maps,Gmaps4rails,我有一些标记列表显示在谷歌地图上。现在我想在关闭信息窗口时做一些额外的事情 google.maps.event.addListener(Gmaps.map.visibleInfoWindow,'closeclick',function() { do_something(); }); 它似乎不起作用。请提供一些教程或代码块来实现这一点 您应该覆盖 大概是这样的: old_method = Gmaps4Rails.Google.Marker.prototype.createInfoWind
google.maps.event.addListener(Gmaps.map.visibleInfoWindow,'closeclick',function()
{
do_something();
});
它似乎不起作用。请提供一些教程或代码块来实现这一点 您应该覆盖
大概是这样的:
old_method = Gmaps4Rails.Google.Marker.prototype.createInfoWindow
Gmaps4Rails.Google.Marker.prototype.createInfoWindow = function(){
old_method();
// then access the infowindow with: this.infowindow and add whatever you need
}
对于1.x,执行相同的操作,但使用:
Gmaps4RailsGoogle.prototype.createInfoWindow
当我运行此Gmaps4Rails.Google.Marker.prototype.createInfoWindow时,我收到类型错误:无法读取未定义的属性“Marker”。我使用gem版本:gmaps4rails(1.5.6)哦,好的,我必须检查这个版本