简体   繁体   English

如何调整内部div容器的高度以适合其他div

[英]How to adjust inner div container height to fit with others divs

Please check the demo link I just want to adjust Geomap div's height to 100%. 请检查演示链接,我只想将Geomap div的高度调整为100%。 I have tried with this Javascript below but its overflowing with the footer. 我已经在下面尝试过使用此Javascript,但是页脚溢出了。

function handleResize() {
var h = $('html').height();
        $('#map-geo').css({'height':h+'px'});
}
$(function(){
        handleResize();
        $(window).resize(function(){
        handleResize();
    });
});

Currently my Html and Body css is 目前,我的HTML和Body CSS是

html, body {
    font-family: 'Open Sans', sans-serif;
    -webkit-font-smoothing: antialiased;
    height:69% !important;
    width:100% !important;  

}

Please do help me out to make it fit. 请帮我解决这个问题。

as far as i know you should replace : 据我所知,您应该更换:

$('#map-geo').css({'height':h+'px'});

with : 与:

$('#map-geo').css('height',h+'px');

And you also need to put the whole function into : 而且您还需要将整个函数放入:

$( document ).ready(function() {
});

You can try this, if it works for you : 如果可以使用,可以尝试一下:

$( document ).ready(function() {
        function handleResize() {
        var h = $('html').height();
            $('#map-geo').css('height',h+'px');
        }
        handleResize();
    });

This alone should resize the element. 仅此一项就应该调整元素的大小。

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

相关问题 调整与另一个Div相关的Divs高度 - Adjust Divs height related to another Div 如何:调整单个div的大小以适合容器,其中有一个类似div的图块 - How to: Resize a single div, to fit the container, where there is a tile of like divs 获取div的高度,并根据检测到的高度调整其他高度 - Get height of the div and adjust others based on height detected 如何设置带有内部浮点的div样式以水平扩展以允许所有内部浮点的div都适合? - How do I style a div with inner floats to expand horizontally to allow all inner floating divs to fit? 每当子div扩展时如何扩展容器div的高度 - How to expand height of the container div whenever child divs are expanded 如何动态调整DIV高度? - How to dynamically adjust DIV height? 如何使用html标签调整字体大小和重排文本以适合父div的宽度和高度 - How to adjust font-size and reflow text to fit the width and height of a parent div with html tags 将父DIV高度调整为内部内容(RSS提要) - Adjust parent DIV height to inner content (RSS feeds) 当屏幕分辨率高度太小而不适合滚动div时,如何使可滚动div不向包含的div中增加高度? - How do I get scrollable div to not add height to containing divs when screen resolution height is too small to fit the scrolling div? 如何使父容器调整其高度以匹配缩放的div - How do I make a parent container adjust it's height to match a scaled div
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM