How do I make an infowindow automatically display as open with Google-Maps-for-Rails

后端 未结 4 1438
情歌与酒
情歌与酒 2021-01-21 23:46

I want to display a map with the infowindow box automatically displayed for the single marker on the page, much like http://code.google.com/apis/maps/documentation/javascript/ex

4条回答
  •  一向
    一向 (楼主)
    2021-01-22 00:32

    Your code is almost perfect. Except that instead of:

     infowindow.open(Gmaps.map, marker);
    

    You should have:

     infowindow.open(Gmaps.map.map, marker);
    

    Indeed, Gmaps.map is a container, Gmap.map.map is the google object.

    I know these names are confusing. Sorry.

    PS: be sure to put this code under the gmaps call in your view.

提交回复
热议问题