简体   繁体   English

将此jQuery映射适应屏幕分辨率

[英]Adapt this jQuery map to the screen resolution

I'm trying to adapt a jQuery map to the screen resolution. 我正在尝试使jQuery映射适应屏幕分辨率。 This is my project link: http://comercialposadas.com/goodbarber/ 这是我的项目链接: http : //comercialposadas.com/goodbarber/

And I use this code in the mapplic.js to resize the map: 我在mapplic.js使用以下代码来调整地图大小:

$(window).resize(function() {
    self.el.height($(window).height());
}).resize();

But the map doesn't show it. 但是地图没有显示。

If you add height:100%; 如果增加height:100%; either to the style of both the html and body elements, or to a CSS file that addresses them and change: 要么更改为htmlbody元素的样式,要么更改为寻址它们并更改的CSS文件:

<div id="mapplic" class="mapplic-element" style="height: 420px;">

to

<div id="mapplic" class="mapplic-element" style="height: 100%;">

it will cause the map to be displayed at full height. 它将导致地图以全高显示。

The reason for changing html and body as well as the #mapplic div is that height needs to be inherited from the root of the document in order to use 100% . 更改htmlbody以及#mapplic div的原因是,高度必须从文档的根部继承才能使用100%

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM