I am working on a project where I am using the Google Maps api-v3 , On the map there will be a few place markers containing information that I am storing in an InfoWindow.
I am wondering is there anyway that you can set an InfoWindow to automatically open on the page load (i.e automatically open without user interaction).
Searching online all I can seem to find is that it needs to be tied to an event listener but all the events the InfoWindow object seems to have are mouse events.
Does anyone know of a workaround of sorts ?
The user can click the close button on the InfoWindow to remove it from the map, or the developer can call close() for the same effect.
Move an info windowAttach the info window to a new marker using the InfoWindow. open() method. Note: If you call open() without passing a marker, the InfoWindow will use the position specified upon construction through the InfoWindowOptions object literal.
Not sure I fully understand your question but this works for me with a hard-coded LatLng:
var infoWindow = null; function initialize() { infoWindow = new google.maps.InfoWindow(); var windowLatLng = new google.maps.LatLng(43.25,-68.03); infoWindow.setOptions({ content: "<div>This is the html content.</div>", position: windowLatLng, }); infoWindow.open(map); } // end initialize google.setOnLoadCallback(initialize);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With