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

  • <small id='88w7v'></small><noframes id='88w7v'>

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

      • <bdo id='88w7v'></bdo><ul id='88w7v'></ul>

      <legend id='88w7v'><style id='88w7v'><dir id='88w7v'><q id='88w7v'></q></dir></style></legend>

      1. 在容器 div 內定位地圖框/傳單地圖

        positioning a mapbox/leaflet map inside a container div(在容器 div 內定位地圖框/傳單地圖)
          <i id='U0Iud'><tr id='U0Iud'><dt id='U0Iud'><q id='U0Iud'><span id='U0Iud'><b id='U0Iud'><form id='U0Iud'><ins id='U0Iud'></ins><ul id='U0Iud'></ul><sub id='U0Iud'></sub></form><legend id='U0Iud'></legend><bdo id='U0Iud'><pre id='U0Iud'><center id='U0Iud'></center></pre></bdo></b><th id='U0Iud'></th></span></q></dt></tr></i><div class="go2g022" id='U0Iud'><tfoot id='U0Iud'></tfoot><dl id='U0Iud'><fieldset id='U0Iud'></fieldset></dl></div>

          1. <legend id='U0Iud'><style id='U0Iud'><dir id='U0Iud'><q id='U0Iud'></q></dir></style></legend>
                  <bdo id='U0Iud'></bdo><ul id='U0Iud'></ul>
                  <tfoot id='U0Iud'></tfoot>
                • <small id='U0Iud'></small><noframes id='U0Iud'>

                    <tbody id='U0Iud'></tbody>
                  本文介紹了在容器 div 內定位地圖框/傳單地圖的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在一個 Ruby on Rails 應用程序中使用 Mapbox.對于我的生活,我無法讓地圖遵守任何簡單的 CSS.唯一允許地圖出現的 CSS 是給它一個絕對位置,頂部和底部都為 0.改變高度和寬度以外的任何東西都會導致地圖消失.我想讓地圖在容器 div 內居中.代碼如下:

                  I am working with Mapbox in a Ruby on Rails app. For the life of me, I cannot get the map to adhere to any simple CSS. The only CSS that allows the map to appear is giving it an absolute position with a top and bottom of 0. Altering anything other than the height and width causes the map to disappear. I want to have the map centered inside a container div. Here is the code:

                  <div id="map-container">
                    <div id='map'>
                    </div>
                  </div>
                  
                  <script>
                  
                  L.mapbox.accessToken = 'pk.eyJ1IjoiYWxvb2thdG9tbW9yb3ciLCJhIjoiNGM4ODhkZjUwMGM1ZDE4M2VjNzQ4MmQ4ODcxMjk5ZjMifQ.XVvFc8kl-0z4NAblE-mNqw';
                  var map = L.mapbox.map('map', 'mapbox.streets').setView([40, -74.50], 10);
                  
                  </script>
                  

                  還有以下 CSS:

                  #map {
                    position: absolute;
                    top: 0;
                    bottom: 0;
                    height: 50%;
                    width: 50%;
                  }
                  

                  如果我改變任何東西,地圖就會消失.我試圖給地圖容器 div 一個相對的位置.那是行不通的.我想要的只是將地圖包含在一個 div 中,這似乎并不難.2013年有一篇關于這個的帖子,但它已經過時了.感謝您的幫助.

                  If I change anything, the map disappears. I have tried to give the map-container div a position of relative. That does not work. All I want is for the map to be contained within a div, it doesn't seem like it should be difficult. There is one post about this from 2013 but it is outdated. Thanks for your help.

                  推薦答案

                  必須為 Leaflet 設置的唯一 css 規則(Mapbox 是 Leaflet) 元素定位靜態/相對時是絕對高度:

                  The only css rule that must be set for Leaflet's (Mapbox is an extended version of Leaflet) element when positioned static/relative is an absolute height:

                  #map {
                      height: 200px;
                  }
                  

                  示例:http://plnkr.co/edit/vdeyLv?p=preview

                  這將始終有效,無論元素嵌套多深.如果未設置寬度,它將使用所有可用的寬度.當您想切換到以百分比設置高度時,您需要確保地圖元素的所有錨元素也都設置了高度:

                  That will work always, doesn't matter how deep the element is nested. When width is not set it will use all the width available. When you want to switch to setting height in percentages, you'll need to make sure that all the anchestor elements of the map element have a height set also:

                  #html, #body, #map-container {
                      height: 100%;
                  }
                  
                  #map {
                      height: 40%;
                  }
                  

                  示例:http://plnkr.co/edit/rAuNC0?p=preview

                  我猜想在 Mapbox 示例中使用絕對定位背后的原因是不必解釋上述內容,因為無論地圖元素嵌套多深,它都能正常工作.

                  I guess the reasoning behind using absolute positioning in the Mapbox examples is that one does not have to explain the above because no matter how deep you nest the map's element, it just works.

                  這篇關于在容器 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 中的默認加載磁貼顏色?)
                  Add external geojson to leaflet layer(將外部geojson添加到傳單層)
                  Adding Leaflet layer control to sidebar(將 Leaflet 圖層控件添加到側邊欄)
                    <tfoot id='OXKiK'></tfoot>
                      1. <legend id='OXKiK'><style id='OXKiK'><dir id='OXKiK'><q id='OXKiK'></q></dir></style></legend>
                        <i id='OXKiK'><tr id='OXKiK'><dt id='OXKiK'><q id='OXKiK'><span id='OXKiK'><b id='OXKiK'><form id='OXKiK'><ins id='OXKiK'></ins><ul id='OXKiK'></ul><sub id='OXKiK'></sub></form><legend id='OXKiK'></legend><bdo id='OXKiK'><pre id='OXKiK'><center id='OXKiK'></center></pre></bdo></b><th id='OXKiK'></th></span></q></dt></tr></i><div class="usqmyei" id='OXKiK'><tfoot id='OXKiK'></tfoot><dl id='OXKiK'><fieldset id='OXKiK'></fieldset></dl></div>

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

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

                              <tbody id='OXKiK'></tbody>
                          • 主站蜘蛛池模板: Brotu | 关注AI,Web3.0,VR/AR,GPT,元宇宙区块链数字产业 | 氧化铁红厂家-淄博宗昂化工 | LINK FASHION 童装·青少年装展| 山东艾德实业有限公司| 密封圈_泛塞封_格莱圈-[东莞市国昊密封圈科技有限公司]专注密封圈定制生产厂家 | 医疗仪器模块 健康一体机 多参数监护仪 智慧医疗仪器方案定制 血氧监护 心电监护 -朗锐慧康 | 德国GMN轴承,GMN角接触球轴承,GMN单向轴承,GMN油封,GMN非接触式密封 | 运动木地板厂家_体育木地板安装_篮球木地板选购_实木运动地板价格 | 模具硅橡胶,人体硅胶,移印硅胶浆厂家-宏图硅胶科技 | 中图网(原中国图书网):网上书店,尾货特色书店,30万种特价书低至2折! | 郑州巴特熔体泵有限公司专业的熔体泵,熔体齿轮泵与换网器生产厂家 | 大通天成企业资质代办_承装修试电力设施许可证_增值电信业务经营许可证_无人机运营合格证_广播电视节目制作许可证 | 电动液压篮球架_圆管地埋式篮球架_移动平箱篮球架-强森体育 | 蜘蛛车-高空作业平台-升降机-高空作业车租赁-臂式伸缩臂叉装车-登高车出租厂家 - 普雷斯特机械设备(北京)有限公司 | 杭州月嫂技术培训服务公司-催乳师培训中心报名费用-产后康复师培训机构-杭州优贝姆健康管理有限公司 | 合景一建-无尘车间设计施工_食品医药洁净车间工程装修总承包公司 | 全国冰箱|空调|洗衣机|热水器|燃气灶维修服务平台-百修家电 | 找果网 | 苹果手机找回方法,苹果iPhone手机丢了找回,认准找果网! | 安徽净化板_合肥岩棉板厂家_玻镁板厂家_安徽科艺美洁净科技有限公司 | 车充外壳,车载充电器外壳,车载点烟器外壳,点烟器连接头,旅行充充电器外壳,手机充电器外壳,深圳市华科达塑胶五金有限公司 | 稳尚教育加盟-打造高考志愿填报平台_新高考志愿填报加盟_学业生涯规划加盟 | 捆扎机_气动捆扎机_钢带捆扎机-沈阳海鹞气动钢带捆扎机公司 | 干法制粒机_智能干法制粒机_张家港市开创机械制造有限公司 | 缠绕机|缠绕膜包装机|缠绕包装机-上海晏陵智能设备有限公司 | 飞象网 - 通信人每天必上的网站 全球化工设备网—化工设备,化工机械,制药设备,环保设备的专业网络市场。 | 模温机-油温机-电加热导热油炉-工业冷水机「欧诺智能」 | 亿诺千企网-企业核心产品贸易| 能量回馈_制动单元_电梯节能_能耗制动_深圳市合兴加能科技有限公司 | 涡轮流量计_LWGY智能气体液体电池供电计量表-金湖凯铭仪表有限公司 | 石英陶瓷,石英坩埚,二氧化硅陶瓷-淄博百特高新材料有限公司 | 房车价格_依维柯/大通/东风御风/福特全顺/江铃图片_云梯搬家车厂家-程力专用汽车股份有限公司 | 雷冲击高压发生器-水内冷直流高压发生器-串联谐振分压器-武汉特高压电力科技有限公司 | 啤酒设备-小型啤酒设备-啤酒厂设备-济南中酿机械设备有限公司 | 岛津二手液相色谱仪,岛津10A液相,安捷伦二手液相,安捷伦1100液相-杭州森尼欧科学仪器有限公司 | 数显水浴恒温振荡器-分液漏斗萃取振荡器-常州市凯航仪器有限公司 | 百方网-百方电气网,电工电气行业专业的B2B电子商务平台 | 数控专用机床,专用机床,自动线,组合机床,动力头,自动化加工生产线,江苏海鑫机床有限公司 | 北京翻译公司_同传翻译_字幕翻译_合同翻译_英语陪同翻译_影视翻译_翻译盖章-译铭信息 | 聚氨酯催化剂K15,延迟催化剂SA-1,叔胺延迟催化剂,DBU,二甲基哌嗪,催化剂TMR-2,-聚氨酯催化剂生产厂家 | 外贮压-柜式-悬挂式-七氟丙烷-灭火器-灭火系统-药剂-价格-厂家-IG541-混合气体-贮压-非贮压-超细干粉-自动-灭火装置-气体灭火设备-探火管灭火厂家-东莞汇建消防科技有限公司 | 标准品网_标准品信息网_【中检计量】 |