开发者

gmaps4rails trigger side bar click event

I'm using gmaps4rails sidebar function to allow jumping to individual marker on the map.

My question is:

how can I trigger the click event on the first sidebar item so the 1st marker's info window will be display开发者_开发问答 by default?


You should just add a callback:

Gmaps.map.callback = function() {
  var firstMarker = Gmaps.map.markers[0];
  var map         = Gmaps.map.map;
  firstMarker.infowindow.open(map, firstMarker.serviceObject);
}

Be sure to put this callback after the gmaps helper in your view.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜