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

Keith Wiley kwiley at keithwiley.com
Fri May 4 11:39:55 EDT 2012


I like the approach you are describing.  Unfortunately, I'm not seeing the legend appear.  Here's how I tried it:

	var layerswitch = new OpenLayers.Control.LayerSwitcher();
	map.addControl(layerswitch);
	var legend_text = "<img src=\"legend.png\">";
	$(layerswitch.layersDiv).append(legend_text);

Do you see any error there which would explain why the legend image doesn't show up?

On May 4, 2012, at 07:14 , Michael Ryan wrote:

> 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);


________________________________________________________________________________
Keith Wiley     kwiley at keithwiley.com     keithwiley.com    music.keithwiley.com

"I used to be with it, but then they changed what it was.  Now, what I'm with
isn't it, and what's it seems weird and scary to me."
                                           --  Abe (Grandpa) Simpson
________________________________________________________________________________



More information about the Users mailing list