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

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

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

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

        <tfoot id='ynqyd'></tfoot>

        單擊 Leaflet Popup 中的鏈接并執行 Javascript

        Click link inside Leaflet Popup and do Javascript(單擊 Leaflet Popup 中的鏈接并執行 Javascript)

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

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

          <tfoot id='zmLNT'></tfoot>

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

            <tbody id='zmLNT'></tbody>
            <legend id='zmLNT'><style id='zmLNT'><dir id='zmLNT'><q id='zmLNT'></q></dir></style></legend>
                  本文介紹了單擊 Leaflet Popup 中的鏈接并執行 Javascript的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  我有一張傳單地圖正在運行.它在地圖上覆蓋了一系列多邊形(通過 GeoJSON)并將彈出窗口附加到每個多邊形.每個彈出窗口都顯示有關該多邊形的信息.

                  I have a leaflet map up and running. It overlays a series of polygons (via GeoJSON) on the map and attaches popups to each polygon. Each of the popups display information about that polygon.

                  我想在彈出窗口中有一個鏈接,單擊該鏈接時,將運行一個 javascript 函數,該函數通過 AJAX 拉出更小的多邊形并顯示它們.

                  I'd like to have inside the popup a link that, when clicked, runs a javascript function that pulls further smaller polygons via AJAX and shows them.

                  我無法讓腳本通過正常的 jQuery/Javascript 點擊事件捕獲對鏈接的點擊.這就是我所說的正常(以下不起作用):

                  I can't get the script to catch a click on the link via the normal jQuery/Javascript click events. Here's what I mean by normal (the following doesn't work):

                  $('a .smallPolygonLink').click(function(e){
                    console.log("One of the many Small Polygon Links was clicked");
                  });
                  

                  bindPopup 部分如下.它在制作時在每個多邊形上運行,并在單擊多邊形時正確彈出.它確實顯示了鏈接,只是不會在點擊時運行上述代碼.

                  The bindPopup part is as follows. It runs on each polygon when made and it pops up correctly on clicking on a polygon. It does show the link, just won't run the above code on click.

                  var popupContent = "Basic Information..." + '<a class="smallPolygonLink" href="#">Click here to see the smaller polygons</a>';
                  layer.bindPopup(popupContent);
                  

                  這里有一個 JSFiddle 來說明這個例子,雖然形式要簡單得多.http://jsfiddle.net/2XfVc/4/

                  Here's a JSFiddle illustrating the example, though in a far simpler form. http://jsfiddle.net/2XfVc/4/

                  推薦答案

                  每次打開彈出窗口時,彈出窗口內的鏈接元素都會從您的標記中動態生成.這意味著當您嘗試將處理程序綁定到它時,該鏈接不存在.

                  The link element inside the popup is being dynamically generated from your markup each time the popup is opened. That means the link doesn't exist when you're trying to bind the handler to it.

                  這里的理想方法是使用 on 將事件處理委托給彈出元素或其祖先.不幸的是,彈出窗口阻止了事件傳播,這就是為什么將事件處理委派給彈出窗口之外的任何靜態元素都行不通的原因.

                  The ideal approach here would be to use on to delegate event handling to the popup element or an ancestor of it. Unfortunately, the popup prevents event propagation, which is why delegating event handling to any static elements outside the popup won't work.

                  您可以做的是預先構建鏈接,附加處理程序,然后將其傳遞給 bindPopup 方法.

                  What you can do is preconstruct the link, attach the handler, and then pass it to the bindPopup method.

                  var link = $('<a href="#" class="speciallink">TestLink</a>').click(function() {
                      alert("test");
                  })[0];
                  marker.bindPopup(link);
                  

                  這是一個演示:http://jsfiddle.net/2XfVc/7/

                  一般來說,要使用多個事件處理程序插入任何類型的復雜標記,請使用以下方法:

                  In general, to insert any sort of complex markup with multiple event handlers, use the folowing approach:

                  // Create an element to hold all your text and markup
                  var container = $('<div />');
                  
                  // Delegate all event handling for the container itself and its contents to the container
                  container.on('click', '.smallPolygonLink', function() {
                      ...
                  });
                  
                  // Insert whatever you want into the container, using whichever approach you prefer
                  container.html("This is a link: <a href='#' class='smallPolygonLink'>Click me</a>.");
                  container.append($('<span class="bold">').text(" :)"))
                  
                  // Insert the container into the popup
                  marker.bindPopup(container[0]);
                  

                  這是一個演示:http://jsfiddle.net/8Lnt4/

                  有關傳單彈出窗口中事件傳播的更多信息,請參閱此 Git 問題.

                  See this Git issue for more on event propagation in leaflet popups.

                  這篇關于單擊 Leaflet Popup 中的鏈接并執行 Javascript的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

                  Browserify, Babel 6, Gulp - Unexpected token on spread operator(Browserify,Babel 6,Gulp - 傳播運算符上的意外令牌)
                  Is it possible to pass a flag to Gulp to have it run tasks in different ways?(是否可以將標志傳遞給 Gulp 以使其以不同的方式運行任務?)
                  Why do we need to install gulp globally and locally?(為什么我們需要在全局和本地安裝 gulp?)
                  How to run Gulp tasks sequentially one after the other(如何一個接一個地依次運行 Gulp 任務)
                  Visual Studio 2015 crashes when opening Javascript files(打開 Javascript 文件時 Visual Studio 2015 崩潰)
                  Detect FLASH plugin crashes(檢測 FLASH 插件崩潰)

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

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

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

                            <tfoot id='tPgEs'></tfoot>
                            主站蜘蛛池模板: 羞羞视频免费观 | 亚洲欧美一区二区三区视频 | 中文字字幕一区二区三区四区五区 | 国产免费一区二区三区 | 成人免费在线观看 | 欧美激情一区二区三区 | 成人区精品一区二区婷婷 | 中文字字幕一区二区三区四区五区 | 日韩欧美国产精品 | 久久久.com| 国产精品一区二区无线 | 99热国产在线播放 | 久久精品国产免费看久久精品 | 成人在线观看免费视频 | 免费黄色网址视频 | 亚洲成人自拍 | 精品三级在线观看 | 91视频久久久久 | 久久久久国产精品一区二区 | 亚洲男人网 | 欧美成人a | 欧美日韩高清 | 国产日韩精品视频 | 欧美黄色网 | 网站一区二区三区 | 欧美成人一区二区三区 | 国产精品国产三级国产aⅴ中文 | 国产精品久久7777777 | 日韩一区三区 | 狠狠爱一区二区三区 | 久久久日韩精品一区二区三区 | 精品一区二区三区免费视频 | 国产欧美精品一区 | 一级黄色片毛片 | 欧美成人猛片aaaaaaa | 91在线观看网址 | 亚洲精品一二三 | 国产精品有限公司 | 综合久久久久久久 | 黄色免费观看网站 | 国产伦精品一区二区三区精品视频 |