The user has markers loaded depending on where they select their location. The markers are cleared when a new location is chosen. If I have an InfoWindow open when I clear the markers, it stays open even though the marker goes away. I want any open InfoWindow to close when the data is refreshed.
My implementation details:
I am using jquery-ui-map to enhance my Google Maps implementation with jQuery.
I attach a click event when creating the markers with the following code (FYI: I took out all the specific details and replaced them with generic ones).
$('#map-canvas').gmap('addMarker', {
'position' : new google.maps.LatLng(latitude, longitude),
'title' : myTitle,
'icon' : myImage,
'shadow' : myShadowImage
}).click(function() {
$('#map-canvas').gmap('openInfoWindow', {
'content' : displayContent(myObject)
}, this);
});
The option openInfoWindow
does not return anything, so storing the InfoWindow object in an array to close it later does not look like a viable option.
Does anyone know how to achieve this using the jquery-ui-map library? I don't see a closeInfoWindow listed in the API documentation.
jquery-ui-map v.beta
jquery-ui-map v rc 1