javascript - google maps polyline mouseout event -
i have polyline different colors. colors mysql db.. working, but: mouseout function not returning same color.. shows default(red) color of line..
comp completed percent.default color red.
could explain?
p.s. sorry english..
function pinfo(poly, html) { google.maps.event.addlistener(poly,"mouseover",function(){ poly.setoptions({ strokecolor:'#ffffff', strokeopacity: .8});}); google.maps.event.addlistener(poly,"mouseout",function(){ poly.setoptions({strokecolor:colorr});}); google.maps.event.addlistener(poly,'click', function(event) { mpenc.setcontent(html); mpenc.setposition(event.latlng); mpenc.open(map); }); } if (comp < 1) { colorr = '#fa0505' } if (comp > 0 && comp < 25 ) { colorr = '#ffa640' } if (comp > 24 && comp < 50) { colorr = '#fffd91' } if (comp > 49 && comp < 75) { colorr = '#e8e400' } if (comp > 74 && comp < 100) { colorr = '#bfffad' } if (comp == 100) { colorr = '#0f8500' } var poly = new g.polyline({ map:map, path:pts, strokecolor:colorr, strokeweight:en, clickable: true, }); pinfo(poly,html);
you have make sure colorr
variable available in pinfo
function.
for example:
var colorr; function pinfo(poly, html) { // use colorr variable here }
have fun!
Comments
Post a Comment