[英]jquery div innerheight not updating when resize browser size
i made jQuery which give me max height of contentarea div and apply it "wrapper" div and mobile view 100% height, but problem is, not problem is no getting height dynamically(Live update when resize browser size) here is code and jsfiddle link https://jsfiddle.net/st0evt1n/1/ 我制作了jQuery,它为我提供了contentarea div的最大高度并将其应用到“包装器” div和移动视图中100%的高度,但是问题是,不是问题是没有动态获得高度(调整浏览器大小时实时更新),这里是代码和jsfiddle链接https://jsfiddle.net/st0evt1n/1/
setmenuheight();
$(window).bind("load resize", function() {
var menuheight = $( window ).width();
if(menuheight <= 768){
$(".wrapper").css('height','100%');
$(".contentarea").css('height','100%');
} else {
setmenuheight();
}
});
function setmenuheight() {
var TabgetHeight = 1;
$(".tabulmain > li").each(function() {
var forHeight = $(this).find(".contentarea").innerHeight();
TabgetHeight = forHeight > TabgetHeight ? forHeight : TabgetHeight;
$(this).find(".contentarea").css('height',forHeight);
});
$(".wrapper").css('height',TabgetHeight+15);
}
I think problem, because you have error in your code. 我认为是有问题的,因为您的代码中有错误。 You get
.width()
of element and treat it like a height
您获得元素的
.width()
并将其视为height
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.