向传单图层控件添加标题 [英] 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.
我认为这很简单,但是我一直找不到解决方案.我尝试了类似于此问题的方法(单选按钮/checkbox在添加虚拟"层后仍保留)和
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?
推荐答案
Layer Control中的输入元素位于
Input Elements in Layer Control are present under
.leaflet-control-layers-overlays
.leaflet-control-layers-overlays
$(".leaflet-control-layers-overlays").prepend("<label>Available layers</label>");
您还可以分配一个类,并为此添加一些样式.这不是一个好的解决方案,但希望对您有帮助.
$(".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.
这篇关于向传单图层控件添加标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!