久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

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

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

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

        傳單:添加標記的鏈接

        Leaflet: Add a link to the markers(傳單:添加標記的鏈接)
          <tbody id='Eoheo'></tbody>

        <tfoot id='Eoheo'></tfoot>

          • <bdo id='Eoheo'></bdo><ul id='Eoheo'></ul>

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

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

            1. <i id='Eoheo'><tr id='Eoheo'><dt id='Eoheo'><q id='Eoheo'><span id='Eoheo'><b id='Eoheo'><form id='Eoheo'><ins id='Eoheo'></ins><ul id='Eoheo'></ul><sub id='Eoheo'></sub></form><legend id='Eoheo'></legend><bdo id='Eoheo'><pre id='Eoheo'><center id='Eoheo'></center></pre></bdo></b><th id='Eoheo'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Eoheo'><tfoot id='Eoheo'></tfoot><dl id='Eoheo'><fieldset id='Eoheo'></fieldset></dl></div>
                1. 本文介紹了傳單:添加標記的鏈接的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  非常簡單的問題:如何使 Leaflet 中的地圖標記可點擊并將用戶引導到其他頁面?每個標記都有自己的頁面.

                  Pretty simple question: How can I make the map markers in Leaflet clickable and route the user to an other page? Every marker has its own page.

                  我嘗試了以下方法但沒有成功;不知何故,所有標記都指向同一個頁面,這是最后分配的 URI.

                  I've tried the following without success; somehow all the markers point to the same page, which is the last assigned URI.

                  var markers = [
                      { coords: [51.505, -0.09], uri: '/some-page' },
                      ...
                  ];
                  
                  for(x in markers)
                  {
                      L.marker(markers[x].coords).on('click', function() {
                          window.location = markers[x].uri;
                      }).addTo(map);
                  }
                  

                  這個問題真讓我抓狂.

                  推薦答案

                  好吧,我終于找到解決方案了;當標記添加到地圖時,它會被分配一個名為_leaflet_id"的 ID.這可以通過目標對象獲取,也可以在將其添加到地圖后設置為自定義值.

                  Okay, I finally came to a solution; when a marker is added to the map it gets assigned an ID called "_leaflet_id". This can be fetched through the target object, and also set to a custom value after it has been added to the map.

                  所以最終的解決方案很簡單:

                  So the final solution is simply:

                  var x = markers.length;
                  
                  while(x--)
                  {
                      L.marker(markers[x].coords).on('click', function(e) {
                          window.location = markers[e.target._leaflet_id].uri;
                      }).addTo(map)._leaflet_id = x;
                  }
                  

                  (我用反向的while循環替換了for-in循環)

                  (I replaced the for-in loop with a reversed while loop)

                  這篇關于傳單:添加標記的鏈接的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Check if a polygon point is inside another in leaflet(檢查一個多邊形點是否在傳單中的另一個內部)
                  Changing leaflet markercluster icon color, inheriting the rest of the default CSS properties(更改傳單標記群集圖標顏色,繼承其余默認 CSS 屬性)
                  Trigger click on leaflet marker(觸發點擊傳單標記)
                  How can I change the default loading tile color in LeafletJS?(如何更改 LeafletJS 中的默認加載磁貼顏色?)
                  Add external geojson to leaflet layer(將外部geojson添加到傳單層)
                  Adding Leaflet layer control to sidebar(將 Leaflet 圖層控件添加到側邊欄)
                      <bdo id='fmCYy'></bdo><ul id='fmCYy'></ul>

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

                          1. <i id='fmCYy'><tr id='fmCYy'><dt id='fmCYy'><q id='fmCYy'><span id='fmCYy'><b id='fmCYy'><form id='fmCYy'><ins id='fmCYy'></ins><ul id='fmCYy'></ul><sub id='fmCYy'></sub></form><legend id='fmCYy'></legend><bdo id='fmCYy'><pre id='fmCYy'><center id='fmCYy'></center></pre></bdo></b><th id='fmCYy'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='fmCYy'><tfoot id='fmCYy'></tfoot><dl id='fmCYy'><fieldset id='fmCYy'></fieldset></dl></div>
                            <legend id='fmCYy'><style id='fmCYy'><dir id='fmCYy'><q id='fmCYy'></q></dir></style></legend>
                            <tfoot id='fmCYy'></tfoot>
                              <tbody id='fmCYy'></tbody>
                          2. 主站蜘蛛池模板: 91欧美| a视频在线播放 | 男插女下体视频 | 在线视频成人 | 国产玖玖| 精品九九| 国产精品久久久久久久一区探花 | 亚洲成人中文字幕 | 男女羞羞视频在线 | 国产精品视频导航 | 久久久久一区 | 成人在线中文字幕 | 国产成人精品一区 | 91精品国产一二三 | 日本免费在线观看视频 | 羞羞视频在线观免费观看 | 亚洲一区二区在线播放 | www.久久久久久久久久久久 | 色综合久久天天综合网 | 久久精品国产免费 | 韩国理论电影在线 | 日韩成人性视频 | 99免费视频 | 国产精品免费av | 91久久久久久久久久久 | 天天操夜夜爽 | 日本中文字幕一区 | 一区二区精品电影 | 日韩成人高清在线 | 午夜噜噜噜 | 天天色影视综合 | 丝袜一区二区三区 | 午夜精品视频 | 天天躁日日躁狠狠很躁 | 亚洲美女网站 | 亚洲一区二区中文字幕 | 99在线精品视频 | 国产精品视频导航 | 精品久久国产 | 午夜a区 | 日韩欧美在线播放 |