• <bdo id='BYwbY'></bdo><ul id='BYwbY'></ul>
        <legend id='BYwbY'><style id='BYwbY'><dir id='BYwbY'><q id='BYwbY'></q></dir></style></legend>
        <i id='BYwbY'><tr id='BYwbY'><dt id='BYwbY'><q id='BYwbY'><span id='BYwbY'><b id='BYwbY'><form id='BYwbY'><ins id='BYwbY'></ins><ul id='BYwbY'></ul><sub id='BYwbY'></sub></form><legend id='BYwbY'></legend><bdo id='BYwbY'><pre id='BYwbY'><center id='BYwbY'></center></pre></bdo></b><th id='BYwbY'></th></span></q></dt></tr></i><div id='BYwbY'><tfoot id='BYwbY'></tfoot><dl id='BYwbY'><fieldset id='BYwbY'></fieldset></dl></div>

        <tfoot id='BYwbY'></tfoot>
      1. <small id='BYwbY'></small><noframes id='BYwbY'>

      2. 将 Leaflet 图层控件添加到侧边栏

        时间:2023-08-09
        <legend id='pxMt6'><style id='pxMt6'><dir id='pxMt6'><q id='pxMt6'></q></dir></style></legend>

          <tfoot id='pxMt6'></tfoot>
          1. <small id='pxMt6'></small><noframes id='pxMt6'>

                <tbody id='pxMt6'></tbody>
                • <bdo id='pxMt6'></bdo><ul id='pxMt6'></ul>

                • <i id='pxMt6'><tr id='pxMt6'><dt id='pxMt6'><q id='pxMt6'><span id='pxMt6'><b id='pxMt6'><form id='pxMt6'><ins id='pxMt6'></ins><ul id='pxMt6'></ul><sub id='pxMt6'></sub></form><legend id='pxMt6'></legend><bdo id='pxMt6'><pre id='pxMt6'><center id='pxMt6'></center></pre></bdo></b><th id='pxMt6'></th></span></q></dt></tr></i><div id='pxMt6'><tfoot id='pxMt6'></tfoot><dl id='pxMt6'><fieldset id='pxMt6'></fieldset></dl></div>
                  本文介绍了将 Leaflet 图层控件添加到侧边栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在使用 Leaflet sidebar V2 插件,我想知道是否可以将传单图层控制菜单放入侧边栏中?任何帮助是极大的赞赏!谢谢!

                  I'm using the Leaflet sidebar V2 plugin and am wondering if it is possible to put a leaflet layer control menu into the sidebar? Any help is greatly appreciated! Thanks!

                  推荐答案

                  只需使用 this 提示.它从地图容器中删除 L.control 元素并将其添加到新的父级.您可以直接对侧边栏执行此操作.

                  Just use this hint. It removes the L.control element from the map container and adds it to a new parent. You can do this for the sidebar straight forward.

                  HTML:

                   <div id="sidebar" class="sidebar collapsed">
                     <div class="sidebar-tabs">
                      <ul role="tablist">
                       <li>....</li>
                       <li>....</li>
                      </ul>
                   </div>
                   <div class="sidebar-content">
                     <div class="sidebar-pane" id="">  
                      <h1 class="sidebar-header">...</h1>
                      <div id="example"> <!--Here the layer control menu will be added--></div>    
                   </div>
                  </div>
                  

                  JS:

                  var layer = L.control.layers(baseMaps, overlayMaps).addTo(map);
                  
                    var htmlObject = layer.getContainer();
                    var a = document.getElementById('example')
                    function setParent(el, newParent){
                      newParent.appendChild(el);
                    }
                    setParent(htmlObject, a);
                  

                  对我来说,这个解决方案效果很好.

                  For me, this solution worked well.

                  这篇关于将 Leaflet 图层控件添加到侧边栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:Leaflet - 在弹出窗口中获取标记的纬度和经度 下一篇:将外部geojson添加到传单层

                  相关文章

                  最新文章

                    <bdo id='eJZOw'></bdo><ul id='eJZOw'></ul>
                  <legend id='eJZOw'><style id='eJZOw'><dir id='eJZOw'><q id='eJZOw'></q></dir></style></legend>

                  <i id='eJZOw'><tr id='eJZOw'><dt id='eJZOw'><q id='eJZOw'><span id='eJZOw'><b id='eJZOw'><form id='eJZOw'><ins id='eJZOw'></ins><ul id='eJZOw'></ul><sub id='eJZOw'></sub></form><legend id='eJZOw'></legend><bdo id='eJZOw'><pre id='eJZOw'><center id='eJZOw'></center></pre></bdo></b><th id='eJZOw'></th></span></q></dt></tr></i><div id='eJZOw'><tfoot id='eJZOw'></tfoot><dl id='eJZOw'><fieldset id='eJZOw'></fieldset></dl></div>
                • <tfoot id='eJZOw'></tfoot>

                    <small id='eJZOw'></small><noframes id='eJZOw'>