Marie-Eve
Marie-Eve

Reputation: 585

Change figure of addLayersControl in leaflet

I'm wondering if there is a way to replace the symbol of addLayersControl in leaflet to something else more customized or even a title.

enter image description here

Upvotes: 5

Views: 547

Answers (1)

Baptiste
Baptiste

Reputation: 1785

I'm not sure you can do it with r language but with CSS you can overide leaflet style like this :

https://jsfiddle.net/84a0uhL1/

.leaflet-control-layers-toggle {
    background-image: url(https://image.flaticon.com/icons/png/512/126/126472.png) !important;
    background-size: 26px;
}

You may not need !important tag if you edit the original css. You can also use :after property and content:"Your text" if you can't use Javascript

Hope it will help you.

Upvotes: 1

Related Questions