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

    <legend id='67iRg'><style id='67iRg'><dir id='67iRg'><q id='67iRg'></q></dir></style></legend>
    <tfoot id='67iRg'></tfoot>

    <small id='67iRg'></small><noframes id='67iRg'>

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

      使傳單工具提示可點擊

      Making Leaflet tooltip clickable(使傳單工具提示可點擊)
        • <bdo id='IOw9k'></bdo><ul id='IOw9k'></ul>
              <tfoot id='IOw9k'></tfoot>

            1. <small id='IOw9k'></small><noframes id='IOw9k'>

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

                <tbody id='IOw9k'></tbody>

                <legend id='IOw9k'><style id='IOw9k'><dir id='IOw9k'><q id='IOw9k'></q></dir></style></legend>
                本文介紹了使傳單工具提示可點擊的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                我想在 Leaflet 地圖(不帶標記)上添加 工具提示 并使其可點擊.以下代碼添加了一個工具提示,但它不可點擊:

                I want to add tooltips on a Leaflet map (without markers) and make them clickable. The following code adds a tooltip but it's not clickable:

                var tooltip = L.tooltip({
                        direction: 'center',
                        permanent: true,
                        interactive: true,
                        noWrap: true,
                        opacity: 0.9
                    });
                tooltip.setContent( "Example" );
                tooltip.setLatLng(new L.LatLng(someLat, someLon));
                tooltip.addTo(myLayer);
                tooltip.on('click', function(event) {
                    console.log("Click!");
                });
                

                我怎樣才能讓它工作?

                推薦答案

                要接收對 L.Tooltip 對象的點擊,您需要:

                To receive clicks on a L.Tooltip object, you'll need to :

                • 在關聯的 DOM 對象上設置監聽器:

                • set up a listener on the associated DOM object :

                var el = tooltip.getElement();
                el.addEventListener('click', function() {
                   console.log("click");
                });
                

              • 刪除 pointer-events: none 在該元素上設置的屬性:

              • remove the pointer-events: none property set on that element:

                var el = tooltip.getElement();
                el.style.pointerEvents = 'auto';
                

              • 到目前為止的演示

                var map = L.map(document.getElementById('map')).setView([48.8583736, 2.2922926], 4);
                L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
                        attribution: '&copy; <a >OpenStreetMap</a> contributors'
                }).addTo(map);
                
                var tooltip = L.tooltip({
                    direction: 'center',
                    permanent: true,
                    interactive: true,
                    noWrap: true,
                    opacity: 0.9
                });
                tooltip.setContent( "Example" );
                tooltip.setLatLng(new L.LatLng(48.8583736, 2.2922926));
                tooltip.addTo(map);
                
                var el = tooltip.getElement();
                el.addEventListener('click', function() {
                    console.log("click");
                });
                el.style.pointerEvents = 'auto';

                html, body {
                  height: 100%;
                  margin: 0;
                }
                #map {
                  width: 100%;
                  height: 180px;
                }

                <link rel="stylesheet" />
                <script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.3.1/leaflet.js"></script>
                   
                <div id='map'></div>

                如果您想創建組件或直接監聽工具提示對象,您可以擴展 L.Tooltip 以將這些更改直接烘焙到定義中:

                If you want to create a component or listen directly to a tooltip object, you can extend L.Tooltip to bake those alterations directly into the definition:

                L.ClickableTooltip = L.Tooltip.extend({
                    onAdd: function (map) {
                        L.Tooltip.prototype.onAdd.call(this, map);
                
                        var el = this.getElement(),
                            self = this;
                
                        el.addEventListener('click', function() {
                            self.fire("click");
                        });
                        el.style.pointerEvents = 'auto';
                    }
                });
                
                var tooltip = new L.ClickableTooltip({
                    direction: 'center',
                    permanent: true,
                    noWrap: true,
                    opacity: 0.9
                });
                tooltip.setContent( "Example" );
                tooltip.setLatLng(new L.LatLng(48.8583736, 2.2922926));
                tooltip.addTo(map);
                
                tooltip.on('click', function(e) {
                    console.log("clicked", JSON.stringify(e.target.getLatLng()));
                });
                

                還有一個演示

                L.ClickableTooltip = L.Tooltip.extend({
                
                    onAdd: function (map) {
                        L.Tooltip.prototype.onAdd.call(this, map);
                
                        var el = this.getElement(),
                            self = this;
                
                        el.addEventListener('click', function() {
                            self.fire("click");
                        });
                        el.style.pointerEvents = 'auto';
                    }
                });
                
                
                var map = L.map(document.getElementById('map')).setView([48.8583736, 2.2922926], 4);
                L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
                        attribution: '&copy; <a >OpenStreetMap</a> contributors'
                }).addTo(map);
                
                var tooltip = new L.ClickableTooltip({
                    direction: 'center',
                    permanent: true,
                    noWrap: true,
                    opacity: 0.9
                });
                tooltip.setContent( "Example" );
                tooltip.setLatLng(new L.LatLng(48.8583736, 2.2922926));
                tooltip.addTo(map);
                
                tooltip.on('click', function(e) {
                    console.log("clicked", JSON.stringify(e.target.getLatLng()));
                });

                html, body {
                  height: 100%;
                  margin: 0;
                }
                #map {
                  width: 100%;
                  height: 180px;
                }

                <link rel="stylesheet" />
                <script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.3.1/leaflet.js"></script>
                   
                <div id='map'></div>

                這篇關于使傳單工具提示可點擊的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 中的默認加載磁貼顏色?)
                Adding Leaflet layer control to sidebar(將 Leaflet 圖層控件添加到側邊欄)
                Leaflet - get latitude and longitude of a marker inside a pop-up(Leaflet - 在彈出窗口中獲取標記的緯度和經度)
                        <tbody id='r0gRC'></tbody>
                    • <i id='r0gRC'><tr id='r0gRC'><dt id='r0gRC'><q id='r0gRC'><span id='r0gRC'><b id='r0gRC'><form id='r0gRC'><ins id='r0gRC'></ins><ul id='r0gRC'></ul><sub id='r0gRC'></sub></form><legend id='r0gRC'></legend><bdo id='r0gRC'><pre id='r0gRC'><center id='r0gRC'></center></pre></bdo></b><th id='r0gRC'></th></span></q></dt></tr></i><div class="3mpgy8q" id='r0gRC'><tfoot id='r0gRC'></tfoot><dl id='r0gRC'><fieldset id='r0gRC'></fieldset></dl></div>
                      <tfoot id='r0gRC'></tfoot>

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

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

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

                        1. 主站蜘蛛池模板: 对照品_中药对照品_标准品_对照药材_「格利普」高纯中药标准品厂家-成都格利普生物科技有限公司 澳门精准正版免费大全,2025新澳门全年免费,新澳天天开奖免费资料大全最新,新澳2025今晚开奖资料,新澳马今天最快最新图库 | 阴离子_阳离子聚丙烯酰胺厂家_聚合氯化铝价格_水处理絮凝剂_巩义市江源净水材料有限公司 | 通用磨耗试验机-QUV耐候试验机|久宏实业百科 | 吊篮式|移动式冷热冲击试验箱-二槽冷热冲击试验箱-广东科宝 | POS机办理_个人POS机免费领取 - 银联POS机申请首页 | 水平垂直燃烧试验仪-灼热丝试验仪-漏电起痕试验仪-针焰试验仪-塑料材料燃烧检测设备-IP防水试验机 | 污水处理设备-海普欧环保集团有限公司 | 广州展台特装搭建商|特装展位设计搭建|展会特装搭建|特装展台制作设计|展览特装公司 | 粘度计NDJ-5S,粘度计NDJ-8S,越平水分测定仪-上海右一仪器有限公司 | 北京翻译公司-专业合同翻译-医学标书翻译收费标准-慕迪灵 | 碳化硅,氮化硅,冰晶石,绢云母,氟化铝,白刚玉,棕刚玉,石墨,铝粉,铁粉,金属硅粉,金属铝粉,氧化铝粉,硅微粉,蓝晶石,红柱石,莫来石,粉煤灰,三聚磷酸钠,六偏磷酸钠,硫酸镁-皓泉新材料 | 衬氟止回阀_衬氟闸阀_衬氟三通球阀_衬四氟阀门_衬氟阀门厂-浙江利尔多阀门有限公司 | 高精度电阻回路测试仪-回路直流电阻测试仪-武汉特高压电力科技有限公司 | YT保温材料_YT无机保温砂浆_外墙保温材料_南阳银通节能建材高新技术开发有限公司 | 防渗膜厂家|养殖防渗膜|水产养殖防渗膜-泰安佳路通工程材料有限公司 | 冲击式破碎机-冲击式制砂机-移动碎石机厂家_青州市富康机械有限公司 | 集装箱展厅-住人集装箱住宿|建筑|房屋|集装箱售楼处-山东锐嘉科技工程有限公司 | 蜂窝块状沸石分子筛-吸附脱硫分子筛-萍乡市捷龙环保科技有限公司 | 不锈钢轴流风机,不锈钢电机-许昌光维防爆电机有限公司(原许昌光维特种电机技术有限公司) | 提升海外网站流量,增加国外网站访客UV,定制海外IP-访客王 | 玉米深加工设备-玉米深加工机械-新型玉米工机械生产厂家-河南粮院机械制造有限公司 | 【化妆品备案】进口化妆品备案流程-深圳美尚美化妆品有限公司 | 红外光谱仪维修_二手红外光谱仪_红外压片机_红外附件-天津博精仪器 | 分子精馏/精馏设备生产厂家-分子蒸馏工艺实验-新诺舜尧(天津)化工设备有限公司 | 桑茶-七彩贝壳桑叶茶 长寿茶 | 桁架机器人_桁架机械手_上下料机械手_数控车床机械手-苏州清智科技装备制造有限公司 | 聚氨酯催化剂K15,延迟催化剂SA-1,叔胺延迟催化剂,DBU,二甲基哌嗪,催化剂TMR-2,-聚氨酯催化剂生产厂家 | 螺杆式冷水机-低温冷水机厂家-冷冻机-风冷式-水冷式冷水机-上海祝松机械有限公司 | 大倾角皮带机-皮带输送机-螺旋输送机-矿用皮带输送机价格厂家-河南坤威机械 | 气弹簧定制-气动杆-可控气弹簧-不锈钢阻尼器-工业气弹簧-可调节气弹簧厂家-常州巨腾气弹簧供应商 | 洛阳防爆合格证办理-洛阳防爆认证机构-洛阳申请国家防爆合格证-洛阳本安防爆认证代办-洛阳沪南抚防爆电气技术服务有限公司 | 伟秀电气有限公司-10kv高低压开关柜-高低压配电柜-中置柜-充气柜-欧式箱变-高压真空断路器厂家 | 济南律师,济南法律咨询,山东法律顾问-山东沃德律师事务所 | 兰州牛肉面加盟,兰州牛肉拉面加盟-京穆兰牛肉面 | MTK核心板|MTK开发板|MTK模块|4G核心板|4G模块|5G核心板|5G模块|安卓核心板|安卓模块|高通核心板-深圳市新移科技有限公司 | 溶氧传感器-pH传感器|哈美顿(hamilton)| 仓储货架_南京货架_钢制托盘_仓储笼_隔离网_环球零件盒_诺力液压车_货架-南京一品仓储设备制造公司 | 茅茅虫AI论文写作助手-免费AIGC论文查重_写毕业论文降重 | 广州企亚 - 数码直喷、白墨印花、源头厂家、透气无手感方案服务商! | 量子管通环-自清洗过滤器-全自动反冲洗过滤器-北京罗伦过滤技术集团有限公司 | 菲希尔FISCHER测厚仪-铁素体检测仪-上海吉馨实业发展有限公司 |