This is a much shorter solution:
1) set up a global variable (within a class or prototype):
var mouseoverTimeoutId = null;
2) set up the google map's event for mouseover on a marker:
google.maps.event.addListener(marker,
'mouseover',
function()
{ ...
mouseoverTimeoutId =
setTimeout(function()
{ ...//Do your normal InfoWindow opening here
},
1000 //This is your timeout to open the infowindow
);
});
3) set up the google map's event for mouseout on a marker:
google.maps.event.addListener(marker,
'mouseout',
function()
{ ...
if(mouseoverTimeoutId)
{ clearTimeout(mouseoverTimeoutId);
mouseoverTimeoutId = null;
}
});
You need to clear the timeout because if you don't, the setTimeout
function gets called no matter what happens.
--
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.