<legend id='E5cqK'><style id='E5cqK'><dir id='E5cqK'><q id='E5cqK'></q></dir></style></legend>
          <bdo id='E5cqK'></bdo><ul id='E5cqK'></ul>
      1. <small id='E5cqK'></small><noframes id='E5cqK'>

      2. <tfoot id='E5cqK'></tfoot>

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

      3. 如何从地图外的链接打开传单标记弹出窗口?

        时间:2023-08-08

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

            <tbody id='LKLU2'></tbody>
          <legend id='LKLU2'><style id='LKLU2'><dir id='LKLU2'><q id='LKLU2'></q></dir></style></legend>
          1. <tfoot id='LKLU2'></tfoot>
          2. <i id='LKLU2'><tr id='LKLU2'><dt id='LKLU2'><q id='LKLU2'><span id='LKLU2'><b id='LKLU2'><form id='LKLU2'><ins id='LKLU2'></ins><ul id='LKLU2'></ul><sub id='LKLU2'></sub></form><legend id='LKLU2'></legend><bdo id='LKLU2'><pre id='LKLU2'><center id='LKLU2'></center></pre></bdo></b><th id='LKLU2'></th></span></q></dt></tr></i><div id='LKLU2'><tfoot id='LKLU2'></tfoot><dl id='LKLU2'><fieldset id='LKLU2'></fieldset></dl></div>
                <bdo id='LKLU2'></bdo><ul id='LKLU2'></ul>

                  本文介绍了如何从地图外的链接打开传单标记弹出窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我有一张带有多个标记的传单地图.

                  I have a leaflet map with several markers on.

                  每个标记都有相似的 html 到

                  Each of the markers have similar html to

                   <img class="leaflet-marker-icon leaflet-clickable leaflet-zoom-animated" src="leaflet/dist/images/marker-icon.png" style="margin-left: -12px; margin-top: -41px; width: 25px; height: 41px; transform: translate(435px, 200px); z-index: 200;" title="location_1">
                  

                  单击标记时,会在标记上方打开弹出窗口.

                  When the marker is clicked the popup opens above the marker.

                  我想做的是在地图之外添加与每个标记相关的链接.

                  What im trying to do is add links outside of the map, relating to each marker.

                  每个标记都有一个唯一的标题.那么我可以创建一个 html 链接列表,标题作为标识符,例如

                  Each of the markers have a unique title. So could I just create a list of html links, with the title as an identifier such as

                   <a class="location_1">location 1</a>
                   <a class="location_2">location 2</a>
                  

                  然后将这些链接绑定到传单地图中对应的标记?

                  Then bind these links to the corresponding marker in the leaflet map?

                  我怎样才能最好地实现这一目标?

                  How would I best achieve this?

                  推荐答案

                  如果将标记添加到数组中,则可以非常简单地根据元素的属性检查它们.

                  if you add the markers to an array, it would be pretty straightforward to check them against attributes of your element.

                  例如:

                  var markers = [];
                  var marker1 = L.marker([51.497, -0.09],{title:"marker_1"}).addTo(map).bindPopup("Marker 1");
                  markers.push(marker1);
                  var marker2 = L.marker([51.495, -0.083],{title:"marker_2"}).addTo(map).bindPopup("Marker 2");
                  markers.push(marker2);
                  var marker3 = L.marker([51.49, -0.097],{title:"marker_3"}).addTo(map).bindPopup("Marker 3");
                  markers.push(marker3);
                  
                  function markerFunction(id){
                      for (var i in markers){
                          var markerID = markers[i].options.title;
                          if (markerID == id){
                              markers[i].openPopup();
                          };
                      }
                  }
                  
                  $("a").click(function(){
                      markerFunction($(this)[0].id);
                  });
                  

                  看到它在这个 fiddle

                  这篇关于如何从地图外的链接打开传单标记弹出窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:查询依赖于 mongodb 中其他文档值的文档 下一篇:在传单弹出窗口中显示图像

                  相关文章

                  最新文章

                  <legend id='AR9Hf'><style id='AR9Hf'><dir id='AR9Hf'><q id='AR9Hf'></q></dir></style></legend>

                  1. <tfoot id='AR9Hf'></tfoot>

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

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

                      <bdo id='AR9Hf'></bdo><ul id='AR9Hf'></ul>