Geeks With Blogs

News



Add to Google

Tim Hibbard CEO for EnGraph software

Kyle complained that sending me a message on Where's Tim didn't always work, that sometimes the InfoWindow would close before he could push send. This was because every 30 seconds an AJAX call was made that would check for my current location.

Looking through the Google Maps documentation, I found the infowindowopen and infowindowclose events. So I created a boolean variable that is checked before my current position is refreshed and set that boolean to true on the infowindowopen event and false on the infowindowclose event.

My code when I add the icon (GMarker):

currMark = new GMarker(pointA);
GEvent.addListener(currMark, "click", function() { currMark.openInfoWindowHtml(av.myBallon); });
GEvent.addListener(currMark, "infowindowopen", function() { noupdate=true; });
GEvent.addListener(currMark, "infowindowclose", function() { noupdate=false; });
map.addOverlay(currMark);

I check the noupdate variable before making the AJAX call and you will see that if the InfoWindow is open and you click "Refresh location using AJAX", my location will not update.

Posted on Thursday, January 12, 2006 7:02 AM Mapping , Where's Tim | Back to top


Comments on this post: Using infowindowopen with Google Maps

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Tim Hibbard | Powered by: GeeksWithBlogs.net