Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 986
Marie-Eve Avatar asked Nov 07 '22 07:11

Marie-Eve


1 Answers

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.

like image 119
Baptiste Avatar answered Nov 13 '22 03:11

Baptiste