这是在谷歌地图上添加 infoWindows 和标记的代码:
infowindow = new google.maps.InfoWindow()
createMarker = (company)->
marker = new google.maps.Marker({
position: new google.maps.LatLng(company.latitude, company.longitude),
map: map,
title: company.name
})
google.maps.event.addListener(marker, 'click', ()->
content = 'some content'
infowindow.setContent(content)
infowindow.open(map,this)
)
createMarker(data[i]) for i in [0..data.length-1] by 1
我需要在页面加载后自动打开第一个 infoWindow。我该怎么做?