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

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

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

      <legend id='EOKVt'><style id='EOKVt'><dir id='EOKVt'><q id='EOKVt'></q></dir></style></legend>
    2. z-index 未按預(yù)期工作

      z-index not working as intended(z-index 未按預(yù)期工作)

      <tfoot id='s5YvV'></tfoot>

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

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

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

                本文介紹了z-index 未按預(yù)期工作的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

                問(wèn)題描述

                我目前正在使用 Leaflet 和 Mapbox 創(chuàng)建自定義地圖.在我開(kāi)始處理彈出窗口之前,一切都運(yùn)行良好.

                我的情況:我有一個(gè)將要使用的自定義導(dǎo)航/控制面板,但它需要任何打開(kāi)的彈出窗口之后(目前不是).

                我準(zhǔn)備了一個(gè)

                我的 CSS 的一部分是

                #map-nav {位置:絕對(duì);左:10px;頂部:10px;z指數(shù):2;}.leaflet-popup-窗格,.leaflet-popup {z-index:1000!重要;}

                默認(rèn)傳單類的 z-index 為 7(我認(rèn)為),我只是將其重寫(xiě)為 100% 確定.在瀏覽器(FF/Chrome)中檢查代碼時(shí),我看到 z-index 設(shè)置正確,并且 .leaflet-popup 中的其他元素沒(méi)有任何 z-index 設(shè)置.

                我已經(jīng)讀到否定的 z-index 可以解決這個(gè)問(wèn)題,但是當(dāng)我使用多個(gè)元素時(shí),我真的很喜歡一個(gè)不那么hacky"的解決方案——如果有的話.(也歡迎使用 JavaScript 解決方案,因此使用標(biāo)簽)

                從代碼檢查中我可以看到,Leaflet 為 .leaflet-popup 設(shè)置了一些屬性,這些屬性在位置方面是:transform: translate3d(..)bottomleft.

                感謝任何幫助.

                我可以把 #map-nav 放在 #map-content 里面,但還是不行):

                1. #map-nav 移動(dòng)到 .leaflet-map-pane
                2. 創(chuàng)建一個(gè) MutationObserver 并觀察 .leaflet-map-pane 的屬性變化.
                3. 每當(dāng) .leaflet-map-panestyle 屬性發(fā)生變化時(shí),抓取它的 style.transform 屬性并提取 x 和 y 值.反轉(zhuǎn)這些值并將它們應(yīng)用到 #map-nav.

                var map = L.map('map-content', {縮放控制:假}).setView([51.505, -0.09], 13);L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}', {attribution: '地圖數(shù)據(jù)和副本;<a >OpenStreetMap</a>貢獻(xiàn)者,<a >CC-BY-SA</a>,圖像 ? <a rauschundrausch.cih3gisks00r8rlly0ob5s2me',訪問(wèn)令牌:'pk.eyJ1IjoicmF1c2NodW5kcmF1c2NoIiwiYSI6ImNpaTYyeW14MTAwNml2eW0zcmR6aHIzdDcifQ.6T8nzYq49rFnvcqk6lgYPg'}).addTo(地圖);var marker = L.marker([51.5, -0.09]).addTo(map);marker.bindPopup("這是一個(gè)<br>大<br>popup<br>在<br>高度方面");var mapNav = document.getElementById("map-nav");var mapPane = document.querySelector(".leaflet-map-pane");var rxTranslate =/translate(?:3d)?(([^)]+))/i;mapPane.appendChild(mapNav);var觀察者=新MutationObserver(函數(shù)(突變){if (mutations.some(m => m.attributeName === "style")) {//應(yīng)用逆變換mapNav.style.transform = "翻譯(" + mapPane.風(fēng)格.轉(zhuǎn)變.match(rxTranslate)[1].分裂(",").slice(0, 2)/* 只提取 x 和 y;丟棄 z */.map(n => parseFloat(n) * -1 + "px")/* 反轉(zhuǎn)值 */+ ")";}});觀察者.觀察(mapPane,{屬性:真});

                #map {位置:固定;頂部:0;右:0;底部:0;左:0;}#地圖導(dǎo)航{位置:絕對(duì);左:10px;頂部:10px;寬度:100px;高度:100px;背景顏色:#ccc;z 指數(shù):200;盒子陰影:插圖 0 0 0 1px #f00;}#地圖內(nèi)容{寬度:100%;高度:100%;}.傳單彈出窗格{z指數(shù):3;}

                <link rel="stylesheet" /><script src="https://code.jquery.com/jquery-2.1.4.min.js"></script><script src="https://unpkg.com/leaflet@1.3.1/dist/leaflet.js"></script><div id="地圖"><div id="地圖內(nèi)容"><div id="map-nav"></div></div></div>

                這可能會(huì)在拖動(dòng)時(shí)在某些客戶端上滯后.您可以使用超時(shí)來(lái)推遲更新,但這意味著導(dǎo)航菜單會(huì)四處移動(dòng),直到您停止拖動(dòng).

                I am currently working with Leaflet and Mapbox to create a custom map. All has been working fine until I started to work on the popups.

                My situation: I have a custom navigation/control panel that will be used but it needs to be behind any open popups (which it currently is not).

                I have prepared a JSFiddle and this screenshot

                Part of my CSS is

                #map-nav {
                  position: absolute;
                  left: 10px;
                  top: 10px;
                  z-index: 2;
                }
                .leaflet-popup-pane, .leaflet-popup {
                  z-index: 1000 !important;
                }
                

                The default leaflet classes have z-index of 7 (I think), I just overwrote it to be 100% sure. When inspecting the code in browser (FF/Chrome), I see that the z-index is set properly and no other element in the .leaflet-popup has any z-index set.

                I have read that negative z-index may solve this, but as I am working with multiple elements I'd really much like a less "hacky" solution - if there is one. (JavaScript solutions are welcome as well, hence the tag)

                As I can see from the code inspection, Leaflet sets some attributes to .leaflet-popup which in terms of position are: transform: translate3d(..), bottom and left.

                Any help is appreciated.

                Edit:

                I can put the #map-nav inside #map-content and it still won't work fiddle. However, when I try to imitate this without alle the map stuff, it does work.

                解決方案

                The problem is that #map-nav exists in an entirely different stacking context than the marker and its popup.

                The way you have it set up right now, the entire map is behind #map-nav. So, changing the z-index on either #map-nav or the .leaflet-popup-pane won't really help.

                Disclaimer: This is a terrible, terrible hack. If you look into Leaflet's documentation and find a way to add your own widgets, I'd highly recommend doing that instead of this.

                That said, I have something which sort of works (your mileage may vary):

                1. Move #map-nav into .leaflet-map-pane
                2. Create a MutationObserver and observe changes to the attributes of .leaflet-map-pane.
                3. Whenever the style attribute of .leaflet-map-pane changes, grab its style.transform property and extract the x and y values. Invert those values and apply them to #map-nav.

                var map = L.map('map-content', {
                  zoomControl: false
                }).setView([51.505, -0.09], 13);
                L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}', {
                  attribution: 'Map data &copy; <a >OpenStreetMap</a> contributors, <a >CC-BY-SA</a>, Imagery ? <a ,
                  maxZoom: 18,
                  id: 'rauschundrausch.cih3gisks00r8rlly0ob5s2me',
                  accessToken: 'pk.eyJ1IjoicmF1c2NodW5kcmF1c2NoIiwiYSI6ImNpaTYyeW14MTAwNml2eW0zcmR6aHIzdDcifQ.6T8nzYq49rFnvcqk6lgYPg'
                }).addTo(map);
                
                var marker = L.marker([51.5, -0.09]).addTo(map);
                marker.bindPopup("this is a<br>large<br>popup<br>in<br>terms of height");
                
                var mapNav = document.getElementById("map-nav");
                
                var mapPane = document.querySelector(".leaflet-map-pane");
                
                var rxTranslate = /translate(?:3d)?(([^)]+))/i;
                
                mapPane.appendChild(mapNav);
                
                var observer = new MutationObserver(function(mutations) {
                  if (mutations.some(m => m.attributeName === "style")) {
                    // apply an inverse transform
                    mapNav.style.transform = "translate(" + mapPane
                      .style
                      .transform
                      .match(rxTranslate)[1]
                      .split(",")
                      .slice(0, 2) /* extract only x and y; discard z */
                      .map(n => parseFloat(n) * -1 + "px") /* invert values */ + ")";
                  }
                });
                
                observer.observe(mapPane, {
                  attributes: true
                });

                #map {
                  position: fixed;
                  top: 0;
                  right: 0;
                  bottom: 0;
                  left: 0;
                }
                #map-nav {
                  position: absolute;
                  left: 10px;
                  top: 10px;
                  width: 100px;
                  height: 100px;
                  background-color: #ccc;
                  z-index: 200;
                  box-shadow: inset 0 0 0 1px #f00;
                }
                #map-content {
                  width: 100%;
                  height: 100%;
                }
                .leaflet-popup-pane {
                  z-index: 3;
                }

                <link rel="stylesheet"  />
                <script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
                <script src="https://unpkg.com/leaflet@1.3.1/dist/leaflet.js"></script>
                <div id="map">
                  <div id="map-content">
                    <div id="map-nav"></div>
                  </div>
                </div>

                This may lag on some clients while dragging. You could use a timeout to defer the update but that would mean the nav menu would move around until you stop dragging.

                這篇關(guān)于z-index 未按預(yù)期工作的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                相關(guān)文檔推薦

                Check if a polygon point is inside another in leaflet(檢查一個(gè)多邊形點(diǎn)是否在傳單中的另一個(gè)內(nèi)部)
                Changing leaflet markercluster icon color, inheriting the rest of the default CSS properties(更改傳單標(biāo)記群集圖標(biāo)顏色,繼承其余默認(rèn) CSS 屬性)
                Trigger click on leaflet marker(觸發(fā)點(diǎn)擊傳單標(biāo)記)
                How can I change the default loading tile color in LeafletJS?(如何更改 LeafletJS 中的默認(rèn)加載磁貼顏色?)
                Adding Leaflet layer control to sidebar(將 Leaflet 圖層控件添加到側(cè)邊欄)
                Leaflet - get latitude and longitude of a marker inside a pop-up(Leaflet - 在彈出窗口中獲取標(biāo)記的緯度和經(jīng)度)

                <tfoot id='kM9Uc'></tfoot>
                <i id='kM9Uc'><tr id='kM9Uc'><dt id='kM9Uc'><q id='kM9Uc'><span id='kM9Uc'><b id='kM9Uc'><form id='kM9Uc'><ins id='kM9Uc'></ins><ul id='kM9Uc'></ul><sub id='kM9Uc'></sub></form><legend id='kM9Uc'></legend><bdo id='kM9Uc'><pre id='kM9Uc'><center id='kM9Uc'></center></pre></bdo></b><th id='kM9Uc'></th></span></q></dt></tr></i><div class="xny3c3q" id='kM9Uc'><tfoot id='kM9Uc'></tfoot><dl id='kM9Uc'><fieldset id='kM9Uc'></fieldset></dl></div>
                • <bdo id='kM9Uc'></bdo><ul id='kM9Uc'></ul>
                      <tbody id='kM9Uc'></tbody>
                    <legend id='kM9Uc'><style id='kM9Uc'><dir id='kM9Uc'><q id='kM9Uc'></q></dir></style></legend>
                  • <small id='kM9Uc'></small><noframes id='kM9Uc'>

                        1. 主站蜘蛛池模板: 氧化锆陶瓷_氧化锆陶瓷加工_氧化锆陶瓷生产厂家-康柏工业陶瓷有限公司 | 绿萝净除甲醛|深圳除甲醛公司|测甲醛怎么收费|培训机构|电影院|办公室|车内|室内除甲醛案例|原理|方法|价格立马咨询 | 示波器高压差分探头-国产电流探头厂家-南京桑润斯电子科技有限公司 | 丝杆升降机-不锈钢丝杆升降机-非标定制丝杆升降机厂家-山东鑫光减速机有限公司 | 拖链电缆_柔性电缆_伺服电缆_坦克链电缆-深圳市顺电工业电缆有限公司 | 编织人生 - 权威手工编织网站,编织爱好者学习毛衣编织的门户网站,织毛衣就上编织人生网-编织人生 | 广州物流公司_广州货运公司_广州回程车运输 - 万信物流 | 膏方加工_丸剂贴牌_膏滋代加工_湖北康瑞生物科技有限公司 | 水热合成反应釜-防爆高压消解罐-西安常仪仪器设备有限公司 | 截齿|煤截齿|采煤机截齿|掘进机截齿|旋挖截齿-山东卓力截齿厂家报价 | 科普仪器菏泽市教育教学仪器总厂| 水平筛厂家-三轴椭圆水平振动筛-泥沙震动筛设备_山东奥凯诺矿机 包装设计公司,产品包装设计|包装制作,包装盒定制厂家-汇包装【官方网站】 | 检验科改造施工_DSA手术室净化_导管室装修_成都特殊科室建设厂家_医疗净化工程公司_四川华锐 | 暖气片十大品牌厂家_铜铝复合暖气片厂家_暖气片什么牌子好_欣鑫达散热器 | 蒸压釜-陶粒板隔墙板蒸压釜-山东鑫泰鑫智能装备有限公司 | 长沙广告公司|长沙广告制作设计|长沙led灯箱招牌制作找望城湖南锦蓝广告装饰工程有限公司 | 不锈钢反应釜,不锈钢反应釜厂家-价格-威海鑫泰化工机械有限公司 不干胶标签-不干胶贴纸-不干胶标签定制-不干胶标签印刷厂-弗雷曼纸业(苏州)有限公司 | 地埋式垃圾站厂家【佳星环保】小区压缩垃圾中转站转运站 | 煤矿支护网片_矿用勾花菱形网_缝管式_管缝式锚杆-邯郸市永年区志涛工矿配件有限公司 | 编织人生 - 权威手工编织网站,编织爱好者学习毛衣编织的门户网站,织毛衣就上编织人生网-编织人生 | 国际金融网_每日财经新资讯网| 济南玻璃安装_济南玻璃门_济南感应门_济南玻璃隔断_济南玻璃门维修_济南镜片安装_济南肯德基门_济南高隔间-济南凯轩鹏宇玻璃有限公司 | 有机肥设备生产制造厂家,BB掺混肥搅拌机、复合肥设备生产线,有机肥料全部加工设备多少钱,对辊挤压造粒机,有机肥造粒设备 -- 郑州程翔重工机械有限公司 | 武汉刮刮奖_刮刮卡印刷厂_为企业提供门票印刷_武汉合格证印刷_现金劵代金券印刷制作 - 武汉泽雅印刷有限公司 | 工业车间焊接-整体|集中除尘设备-激光|等离子切割机配套除尘-粉尘烟尘净化治理厂家-山东美蓝环保科技有限公司 | 破碎机_上海破碎机_破碎机设备_破碎机厂家-上海山卓重工机械有限公司 | 外观设计_设备外观设计_外观设计公司_产品外观设计_机械设备外观设计_东莞工业设计公司-意品深蓝 | 红立方品牌应急包/急救包加盟,小成本好项目代理_应急/消防/户外用品加盟_应急好项目加盟_新奇特项目招商 - 中红方宁(北京) 供应链有限公司 | 水篦子|雨篦子|镀锌格栅雨水篦子|不锈钢排水篦子|地下车库水箅子—安平县云航丝网制品厂 | 杭州代理记账多少钱-注册公司代办-公司注销流程及费用-杭州福道财务管理咨询有限公司 | 万濠影像仪(万濠投影仪)百科-苏州林泽仪器 | 合肥通道闸-安徽车牌识别-人脸识别系统厂家-安徽熵控智能技术有限公司 | 科研ELISA试剂盒,酶联免疫检测试剂盒,昆虫_植物ELISA酶免试剂盒-上海仁捷生物科技有限公司 | 美的商用净水器_美的直饮机_一级代理经销商_Midea租赁价格-厂家反渗透滤芯-直饮水批发品牌售后 | 合肥弱电工程_安徽安防工程_智能化工程公司-合肥雷润 | 周易算网-八字测算网 - 周易算网-宝宝起名取名测名字周易八字测算网 | 皮带式输送机械|链板式输送机|不锈钢输送机|网带输送机械设备——青岛鸿儒机械有限公司 | 西点培训学校_法式西点培训班_西点师培训_西点蛋糕培训-广州烘趣西点烘焙培训学院 | 【中联邦】增稠剂_增稠粉_水性增稠剂_涂料增稠剂_工业增稠剂生产厂家 | 中图网(原中国图书网):网上书店,尾货特色书店,30万种特价书低至2折! | 洁净化验室净化工程_成都实验室装修设计施工_四川华锐净化公司 |