Looking at your code it appears you will have multiple info windows
open if you mouse over multiple markers. I see nothing that closes
one.

Since you are creating an info window in the add_marker function each
time you create a marker, each marker has it's own info window.
You need to move the creation of the info window out of the add_marker
function so each time a marker is moused over it will essentially move
the info window to the current marker.

Hope this helps.

Alan


On Jan 2, 8:49 am, MadRhino <[email protected]> wrote:
> I'm using a basic script borrowed from another developer... the map
> supports multiple markers, which I like.
> The issue I am having is that I need any existing "infowindow(s)" that are
> opened to be closed on "mouseover" of any marker.
>
> I have tried different approaches, but all has failed. Any help would be
> great!
>
> Thanks!
>
> Here is the code
>
> var map ;
>   function initialize() {
>     var latlng = new google.maps.LatLng(-34.397, 145.644);
>     var myOptions = {
>       zoom: 5,
>       center: latlng,
>       mapTypeId: google.maps.MapTypeId.ROADMAP // can be SATELLITE  ,
> HYBRID, ROADMAP or TERRAIN
>     };
>     map = new google.maps.Map(document.getElementById("map"), myOptions);
>
>     var marker = add_marker(-34.397, 150.644,"Some title!","html for info
> box"); // pass in as Latitude, then Longitude
>     marker.setMap(map);
>
>     var html_box = "<a href=\"foo bar\">tesT</a>";
>     var marker = add_marker(-33.397, 140.644,"Some title!",html_box); //
> pass in as Latitude, then Longitude
>     marker.setMap(map);
>   }
>
>   function add_marker(lat,lng,title,box_html) {
>     var infowindow = new google.maps.InfoWindow({
>         content: box_html
>     });
>
>     var marker = new google.maps.Marker({
>           position: new google.maps.LatLng(lat,lng),
>           map: map,
>           title: title
>     });
>
>     google.maps.event.addListener(marker, 'mouseover', function() {
>       infowindow.open(map,marker);
>     });
>     return marker;
>   }

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to