Leaflet - 将控件放在 div 地图之外

Leaflet - put controls outside the div map(Leaflet - 将控件放在 div 地图之外)
本文介绍了Leaflet - 将控件放在 div 地图之外的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我制作了以下应用程序:http://lae2.alwaysdata.net/carte/exppng/

I made the following app : http://lae2.alwaysdata.net/carte/exppng/

我想将我的两个控件(leaflet-control-zoom 和leaflet-control-layers)放在 div 地图之外.例如,我想在灰色区域内使用它们.

I'd like to put my two controls (leaflet-control-zoom and leaflet-control-layers) outside the div map. I'd want to use them inside the grey area for example.

我想知道这是否可能:我寻找了一些技巧,但我没有找到任何东西......

I'd like to know if it's possible : I looked for some tricks but I didn't find anything...

如果可以,你能帮帮我吗?

If it is could you help me ?

谢谢!

推荐答案

您可能会对以下帖子感兴趣:

You would probably be interested in the following posts:

  • 获取Leaflet的当前比例值
  • https://gis.stackexchange.com/questions/83942/display-a-control-zoom-bar-outside-map-container-in-leaflet

本质上:

document.getElementById("myNewContainerId").appendChild(
    L.control.layers(base, overlays).onAdd(map)
);

外部来源:

  • https://groups.google.com/forum/#!searchin/leaflet-js/control$20onadd/leaflet-js/rKMZX3PKFuI
  • https://groups.google.com/forum/#!searchin/leaflet-js/control$20onadd/leaflet-js/rKMZX3PKFuI

这篇关于Leaflet - 将控件放在 div 地图之外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Update another component when Formik form changes(当Formik表单更改时更新另一个组件)
Formik validation isSubmitting / isValidating not getting set to true(Formik验证正在提交/isValiating未设置为True)
React Validation Max Range Using Formik(使用Formik的Reaction验证最大范围)
Validation using Yup to check string or number length(使用YUP检查字符串或数字长度的验证)
Updating initialValues prop on Formik Form does not update input value(更新Formik表单上的初始值属性不会更新输入值)
password validation with yup and formik(使用YUP和Formick进行密码验证)