Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add a title to leaflet layers control

Does anyone have a method for adding a title to a leaflet layers control? Just a line of text, for example "Available layers." Ideally I'd like to add a link to the text as well.

I thought it would be simple, but I haven't been able to find a solution. I tried methods similar to this question (radio button/checkbox remains after adding "dummy" layer) and this question (adds div to end of layers, seems more complex than my needs). Unfortunately with my experience level, I haven't been able to connect the dots. Any suggestions?

like image 570
Evan Avatar asked Sep 15 '25 16:09

Evan


1 Answers

Input Elements in Layer Control are present under

.leaflet-control-layers-overlays

$(".leaflet-control-layers-overlays").prepend("<label>Available layers</label>"); You can also assign a class and add some styling on this. This is not good solution but hope it helps you.

like image 69
Saurabh Yadav Avatar answered Sep 18 '25 06:09

Saurabh Yadav