0
我在一個rails v.3.1.11應用程序和使用gmaps4rails gem。根據我見過各種實例 ,我引誘到做這個主題的目標是:在我看來,(使用HAML)的頁腳gmaps4rails默認打開infowindow
:
= yield :scripts
:javascript
Gmaps.map.callback = function(){
console.log('callback');
$(document).trigger('map:ready');
}
然後定義一個觸發器咖啡腳本文件:
$(document).on 'map:ready', -> openInfoWindow()
openInfoWindow = ->
for m in Gmaps.map.markers
marker = m.serviceObject
google.maps.event.addListener marker, "click" ->
infowindow.open(map,marker)
infowindow.open(map,marker)
,但我有一個錯誤:未捕獲的ReferenceError:對象沒有定義 我做其他的嘗試,但我無法弄清楚如何設置的東西
結帳這個.. http://stackoverflow.com/questions/7774664/how-do-i-make-an-infowindow-automatically-display-as -open與 - 谷歌 - 地圖換-R – Unknown 2013-04-29 05:17:10