开发者

gmaps4rails trigger side bar click event

开发者 https://www.devze.com 2023-04-08 03:36 出处:网络
I\'m using gmaps4rails sidebar function to allow jumping to individual marker on the map. My question is:

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

精彩评论

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