Reputation: 2008
I have a map which has polygons defining various locations.
I am trying to trigger an infowindow when the pointer mouses over the polygon, and then remove it when the mouse leaves. i have center coordinates for the polygons, and there is no marker.
All of the infowindow examples I found are based on having a marker point.
How can I acheive this without a marker?
Upvotes: 2
Views: 979
Reputation: 3429
You can attach the infoWindow creation to the polygon mouseover
event. Then have the window close when the user mouses out. Something like this:
google.maps.event.AddListener("mouseover", polygon, function() {
infoWindow.setPosition(latLng)
infoWindow.open(map)
})
google.maps.event.AddListener("mouseout", polygon, function() {
infoWindow.close()
})
Upvotes: 3