1

in this code you have an example of layer switcher use in OpenLayers

https://rawgit.com/walkermatt/ol-layerswitcher/master/examples/layerswitcher.html

The button which triggers the action is written in .js using ol.control.LayerSwitcher, though.

var layerSwitcher = new ol.control.LayerSwitcher({
    tipLabel: 'Légende' // Optional label for button
});
map.addControl(layerSwitcher);

What do I have to change if I want the same pop-up to be displayed, but by clicking the HTML icon in the "navbar" div of the site, not this button?

2

To display or hide from your own code use

layerSwitcher.showPanel();
layerSwitcher.hidePanel();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.