[英]customize properties in leaflet
I am new to leaflet and have used leaflet Routing Machine for the routing service in open street map. 我是传单的新手,并且已经在开放的街道地图中将传单路由机用于路由服务。 I want to customize the default layout.
我要自定义默认布局。 For example, from API documentation, I could change the default location of zoom icons:
例如,从API文档中,我可以更改缩放图标的默认位置:
var zoom=L.control.zoom({
position:'topright',
}).addTo(map);
But I want to make more changes to the default properties like display the zoom buttons inline, or change the background properties. 但是我想对默认属性进行更多更改,例如内联显示缩放按钮或更改背景属性。
I tried getting the div
from inspect element and changed the look some how but it is very limited. 我尝试从inspect元素中获取
div
并更改了外观,但它非常有限。 Is there any way i can fully access and alter the layout properties in leaflet ? 有什么办法可以完全访问和更改传单中的布局属性?
There is no other logic you can use than the position
option, as you already found out. 正如您已经发现的那样,除了
position
选项外,没有其他逻辑可以使用。 The leaflet zoom control is nothing more than the following markup: 传单缩放控件仅是以下标记:
<div class="leaflet-control-zoom leaflet-bar leaflet-control">
<a class="leaflet-control-zoom-in" href="#" title="Zoom in">+</a>
<a class="leaflet-control-zoom-out" href="#" title="Zoom out">-</a>
</div>
All styling is done through CSS and that's the way to go when you want to customize it. 所有样式都是通过CSS完成的,这就是您要自定义样式的方法。 For instance switching to inline and changing the background-color.
例如,切换为内联并更改背景颜色。
.leaflet-control-zoom a {
display: inline-block;
background-color: blue;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.