I made a test case real quick. This worked for me: marker.setZIndex(999); //hover marker.setZIndex(undefined); //undo
Chad Killingsworth On Mar 14, 10:44 am, koichirose <[email protected]> wrote: > Hello. > I have multiple markers on my map and some of them overlap. > So I'm trying to set a higher zIndex on the marker I'm currently > hovering on, so that it'll go on top of the others. > When I hover out I have to set the old zIndex back, otherwise it'll > remain on top. > > Here's what I tried: > google.maps.event.addListener(marker, "mouseover", function() { > this.old_ZIndex = this.getZIndex(); > console.log(this.old_ZIndex); //<<<<<<---this is undefined, > why? > this.setZIndex(1000); > }); > google.maps.event.addListener(marker, "mouseout", function() { > if (this.old_ZIndex) > this.setZIndex(this.old_ZIndex); > }); > > I reported it as an issue (http://code.google.com/p/gmaps-api-issues/ > issues/detail?id=2150), but they told me this is the desired > behaviour. > Setting a default ZIndex is not an option, since I don't want to lose > the default behaviour (By default, Markers are displayed according to > their latitude, with Markers of lower latitudes appearing in front of > Markers at higher latitudes.) > > How can I solve this? -- 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.
