[OpenLayers-Users] Update Markers

Christopher Schmidt crschmidt at metacarta.com
Fri Nov 2 18:50:44 EDT 2007


On Fri, Nov 02, 2007 at 03:28:05PM -0700, Paul A. Smith wrote:
> 
> 
> Christopher Schmidt-4 wrote:
> > 
> > There is no 'supported' way of doing this, but marker.icon.imageDiv is
> > the actual container for the image. (This probably is a div, with an img
> > as its firstChild.) Using this and just changing
> > marker.icon.imageDiv.firstChild.src will probably work, but it is
> > possible (though at this point, seems relatively unlikely) that the name 
> > 'imageDiv' will change in the future, so you should be prepared to check
> > your code against a new release before switching over.
> > 
> 
> I'm using this technique to swap out/in marker icons based on certain
> events. It works, but when the map is zoomed in or out, the marker icons
> revert to their initial state. Any way I can make them "stick"?

Set the 'url' property on the icon as well. (In trunk, use the setUrl
function instead.)

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list