[OpenLayers-Users] Place an image in the corner?

Michael Ryan mr at mry4n.net
Fri May 4 10:14:15 EDT 2012


Hi Keith,

Here's what I did to add a legend that's connected to the
LayerSwitcher. I did this so that you can hide the layer switcher and
the legend simultaneously by clicking on the '+'.

The key here is that 'layersDiv' is a property of the layer.

var layerswitch = new OpenLayers.Control.LayerSwitcher();
map.addControl(layerswitch);
var legend_text = <your html and styled text here>;
$(layerswitch.layersDiv).append(legend_text);

If that's not exactly what you want, you can dig around in Firebug to
see where you can add a div. I would think you could add a div within
the map div and with some styling tweaks get the image to just sit up
in the corner.

-Mike


More information about the Users mailing list