javascript - jVectorMap 高度 :% does not work

标签 javascript css jvectormap

我正在使用这个库:http://jvectormap.com/为我的网站创建 map 。我试图通过 style 属性将 map 的宽度和高度设置为 100%,以使 map 以全屏大小显示。

当我指定以下内容时:

<div id="map1" style="width: 100%; height: 100%"></div>

map 显示如下: enter image description here

宽度属性似乎可以正常工作,但高度属性却不能。当我调整窗口大小时,宽度会正确缩放,而无论我是放大还是缩小图像,高度似乎都在不断增加。

如何使用百分比使 map 以指定比例显示?

最佳答案

在你的 CSS 中试试这个:

head {
    height:100%;
}
#map1 {
    position:absolute;
    height:100%;
}

将 head 元素的高度设置为 100% 设置 map 高度的定义。

关于javascript - jVectorMap 高度 :% does not work,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27327768/

相关文章:

javascript - 如何正确地将鼠标坐标传递给WebGL?

javascript - 模态窗口不适用于分页数据表

html - 手机底部对齐

javascript - 如何自定义 jVectorMap 区域弹出窗口?

javascript - jvectormap 仅显示特定区域的标签

javascript - jvectormap 标记

javascript - 使用vue折叠表格中的单元格

javascript - 如何取消表单提交?

html - 具有可滚动内容的固定页眉、页脚

php - 无法在 Laravel 中获取 app.scss 的完整文件