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.
精彩评论