Reputation: 19
I have a simple Google map v3 with only one marker with this code:
google.maps.event.addListener(myplaceMarker, 'click', function() {
infowindow.open(map,myplaceMarker);
With this code, info window opens when I click on the marker. How can I make the info window show up automatically when the map loads on the page?
SOLVED: I just needed to remove the first row.
Upvotes: 1
Views: 742
Reputation: 157
Another way to open the infoWindow when map loads or from any other event ( like when selecting a row where you have some results that has got location relation), then you invoke below piece of code. This means your infoWindow is associated with marker for 'click' event and you can trigger this 'click' event from anywhere based on your requirements.
google.maps.event.trigger(marker,'click');
Upvotes: 1
Reputation: 3532
Make the call to open the map outside of the listener, else it will be set to happen when the marker object is clicked.
Upvotes: 0