I have created some polygons and a html list with their names. I want to change a polygon’s opacity when the mouse hovers over its name in the list.
...
<li><a href="#" data-poly="polyID" class="hoverPoly">City</a></a>
...
$('.hoverPoly').live('onmouseover',function(){
var polyName = $(this).attr('data-poly');
// var gmap is reference to google map
// I want find polygon with polyName
})
polygon set as
function initialize(){
...
var poly_444555 = new google.maps.Polygon({
...
name:'polyID', // this is id for external access
})
}
very complicated example
Key point:
Uses something like this in the sidebar HTML (one for each polygon in the array). When the user mouses over the element, it modifies the properties of the polygon, putting the properties back on mouse out:
The kmlHighlightPoly method currently changes the color of the polygon, but it could just as easily change the opacity.