openInfoWindowHtml on onload

1,862 views
Skip to first unread message

Anees

unread,
Jun 29, 2010, 3:37:50 AM6/29/10
to Google Maps JavaScript API v3
Hello
have added a Listener to show a info for the Map marker as

GEvent.addListener(marker, 'click', function() {
marker.openInfoWindowHtml(html);
});

Now,
How can show that html without clicking on the marker
I mean
immediately after the Map loads

tried 'load' instead of 'click' but not worked

please help

Thanks n regards
Anees

Davide Cremonesi

unread,
Jun 29, 2010, 7:07:01 AM6/29/10
to google-map...@googlegroups.com
Try to trigger the event programmatically:

google.maps.event.trigger(marker,'click');

2010/6/29 Anees <muhd....@gmail.com>

--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.
To post to this group, send email to google-map...@googlegroups.com.
To unsubscribe from this group, send email to google-maps-js-a...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.


Davide Cremonesi

unread,
Jun 29, 2010, 7:21:34 AM6/29/10
to google-map...@googlegroups.com
I did some tests and seems that the event cannot be triggered before the map is loaded, therefore I trigger the event only on the map idle event,

google.maps.event.addListener(map, 'idle', function(){
   google.maps.event.trigger(marker,'click');
 });

You should call also the removeListener once the callback function has been called once

Hope it helps,
Davide



2010/6/29 Anees <muhd....@gmail.com>

Davide Cremonesi

unread,
Jun 29, 2010, 7:28:14 AM6/29/10
to google-map...@googlegroups.com
Here is a working example:

http://neogismap.appspot.com/debugAndDemo/clickOnLoad/index.html

Bye, Davide

2010/6/29 Anees <muhd....@gmail.com>
Reply all
Reply to author
Forward
0 new messages