Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

google maps v3 API mouseover with polygons?

I'm building a map using the google v3 api because it is way faster. Essentially, it's a map of an area with about 30 cities with polygons over the regions. When a user hovers over a city, I want the fillColor to get lighter, and then return to it's normal state on mouseout. when a user click, it redirects them to another page.

The click event works just fine. But, looking through the v3 API documentation, it seems as if Google has implemented click, doubleclick, mousemove, mousedown and mouseup as event triggers, but no hover, or mouseover, or mouseout.

Really? Geez. I'd think over and out would be higher priority than down and up.

Anyway, has anybody else come across this? Am I wrong? Or is there a workaround?

Thank you in advance for your help, Stephanie

like image 217
Steph Rose Avatar asked Nov 17 '09 20:11

Steph Rose


1 Answers

The following works:

google.maps.event.addListener(polygon,"mouseover",function(){  this.setOptions({fillColor: "#00FF00"}); });   google.maps.event.addListener(polygon,"mouseout",function(){  this.setOptions({fillColor: "#FF0000"}); }); 
like image 187
Harmen Wessels Avatar answered Oct 05 '22 11:10

Harmen Wessels