pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

        <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="wecikec" 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="0goii2e" 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="ms2qcga" 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>
                            主站蜘蛛池模板: 高效复合碳源-多核碳源生产厂家-污水处理反硝化菌种一长隆科技库巴鲁 | 环氧乙烷灭菌器_压力蒸汽灭菌器_低温等离子过氧化氢灭菌器 _低温蒸汽甲醛灭菌器_清洗工作站_医用干燥柜_灭菌耗材-环氧乙烷灭菌器_脉动真空压力蒸汽灭菌器_低温等离子灭菌设备_河南省三强医疗器械有限责任公司 | 工控机,嵌入式主板,工业主板,arm主板,图像采集卡,poe网卡,朗锐智科 | 层流手术室净化装修-检验科ICU改造施工-华锐净化工程-特殊科室建设厂家 | 防水套管|柔性防水套管|伸缩器|伸缩接头|传力接头-河南伟创管道 防水套管_柔性防水套管_刚性防水套管-巩义市润达管道设备制造有限公司 | 匀胶机旋涂仪-声扫显微镜-工业水浸超声-安赛斯(北京)科技有限公司 | 电子海图系统-电梯检验系统-智慧供热系统开发-商品房预售资金监管系统 | 不锈钢螺丝,不锈钢螺栓,不锈钢标准件-江苏百德特种合金有限公司 交变/复合盐雾试验箱-高低温冲击试验箱_安奈设备产品供应杭州/江苏南京/安徽马鞍山合肥等全国各地 | 铝合金风口-玻璃钢轴流风机-玻璃钢屋顶风机-德州东润空调设备有限公司 | 破碎机锤头_合金耐磨锤头_郑州宇耐机械工程技术有限公司 | 船用锚链|专业锚链生产厂家|安徽亚太锚链制造有限公司 | 防水套管厂家_刚性防水套管_柔性防水套管_不锈钢防水套管-郑州中泰管道 | 合肥活动房_安徽活动板房_集成打包箱房厂家-安徽玉强钢结构集成房屋有限公司 | 杭州标识标牌|文化墙|展厅|导视|户内外广告|发光字|灯箱|铭阳制作公司 - 杭州标识标牌|文化墙|展厅|导视|户内外广告|发光字|灯箱|铭阳制作公司 | 胶水,胶粘剂,AB胶,环氧胶,UV胶水,高温胶,快干胶,密封胶,结构胶,电子胶,厌氧胶,高温胶水,电子胶水-东莞聚力-聚厉胶粘 | 耐热钢-耐磨钢-山东聚金合金钢铸造有限公司 | 耐磨陶瓷,耐磨陶瓷管道_厂家-淄博拓创陶瓷科技| 网站建设,北京网站建设,北京网站建设公司,网站系统开发,北京网站制作公司,响应式网站,做网站公司,海淀做网站,朝阳做网站,昌平做网站,建站公司 | 美甲贴片-指甲贴片-穿戴美甲-假指甲厂家--薇丝黛拉 | SOUNDWELL 编码器|电位器|旋转编码器|可调电位器|编码开关厂家-广东升威电子制品有限公司 | 周易算网-八字测算网 - 周易算网-宝宝起名取名测名字周易八字测算网 | 盐水蒸发器,水洗盐设备,冷凝结晶切片机,转鼓切片机,絮凝剂加药系统-无锡瑞司恩机械有限公司 | 高硼硅玻璃|水位计玻璃板|光学三棱镜-邯郸奥维玻璃科技有限公司 高温高压釜(氢化反应釜)百科 | 云南标线|昆明划线|道路标线|交通标线-就选云南云路施工公司-云南云路科技有限公司 | 深圳离婚律师咨询「在线免费」华荣深圳婚姻律师事务所专办离婚纠纷案件 | 尊享蟹太太美味,大闸蟹礼卡|礼券|礼盒在线预订-蟹太太官网 | 【化妆品备案】进口化妆品备案流程-深圳美尚美化妆品有限公司 | 密集架|电动密集架|移动密集架|黑龙江档案密集架-大量现货厂家销售 | 闭端端子|弹簧螺式接线头|防水接线头|插线式接线头|端子台|电源线扣+护线套|印刷电路板型端子台|金笔电子代理商-上海拓胜电气有限公司 | pbt头梳丝_牙刷丝_尼龙毛刷丝_PP塑料纤维合成毛丝定制厂_广州明旺 | hdpe土工膜-防渗膜-复合土工膜-长丝土工布价格-厂家直销「恒阳新材料」-山东恒阳新材料有限公司 ETFE膜结构_PTFE膜结构_空间钢结构_膜结构_张拉膜_浙江萬豪空间结构集团有限公司 | 网站优化公司_北京网站优化_抖音短视频代运营_抖音关键词seo优化排名-通则达网络 | 爱德华真空泵油/罗茨泵维修,爱发科-比其尔产品供应东莞/杭州/上海等全国各地 | 电动高压冲洗车_价格-江苏速利达机车有限公司 | 圆形振动筛_圆筛_旋振筛_三次元振动筛-河南新乡德诚生产厂家 | 玻璃钢型材-玻璃钢风管-玻璃钢管道,生产厂家-[江苏欧升玻璃钢制造有限公司] | 浩方智通 - 防关联浏览器 - 跨境电商浏览器 - 云雀浏览器 | 磁力反应釜,高压釜,实验室反应釜,高温高压反应釜-威海自控反应釜有限公司 | 长沙一级消防工程公司_智能化弱电_机电安装_亮化工程专业施工承包_湖南公共安全工程有限公司 | 东莞动力锂电池保护板_BMS智能软件保护板_锂电池主动均衡保护板-东莞市倡芯电子科技有限公司 | 企业微信scrm管理系统_客户关系管理平台_私域流量运营工具_CRM、ERP、OA软件-腾辉网络 |