计算元素的高度宽度,动态设置高度

<div id='div'></div>
#div{
	height:100px;
	width:100px;
	padding:10px;
	margin:20px;
	border:1px solid black
}
计算高度
	$("#div").height()  //100
	$("#div").innerHeight()  //包含padding   100+10+10
	$("#div").outerHeight()  //包含padding+border   100+10+10+1+1
	$("#div").outerHeight(true)  //包含padding+border+margin   100+10+10+1+1+20+20
	
计算宽度
	$("#div").width()  //100
	$("#div").innerWidth()  //包含padding   100+10+10
	$("#div").outerWidth()  //包含padding+border   100+10+10+1+1
	$("#div").outerWidth(true)  //包含padding+border+margin   100+10+10+1+1+20+20

// 获取 附件  收件人的div  高度
				console.log($(".fbrxx").outerHeight(true))
				console.log($(".fujian").outerHeight(true))
				console.log($(".shoujainrn").outerHeight(true))
				console.log($(".d-wapperPage").outerHeight(true))
				
				// console.log($(".w-e-text-container").css('height',600))
				if(!this.isXiaoPm){  //大屏
					if ($(".fujian").outerHeight(true) == undefined){
						$(".w-e-text-container").height( this.windowHeigth - $(".shoujainrn").outerHeight(true) - $(".fbrxx").outerHeight(true) - 273)
					}else {
						$(".w-e-text-container").height( this.windowHeigth - $(".fujian").outerHeight(true) - $(".shoujainrn").outerHeight(true) - $(".fbrxx").outerHeight(true) - 340)
					}
				}else {
					// 小屏
					if ($(".fujian1").outerHeight(true) == undefined){
						$(".w-e-text-container").height( this.windowHeigth - $(".shoujainrn1").outerHeight(true) - $(".fbrxx").outerHeight(true) - 273)
					}else {
						$(".w-e-text-container").height( this.windowHeigth - $(".fujian1").outerHeight(true) - $(".shoujainrn1").outerHeight(true) - $(".fbrxx").outerHeight(true) - 340)
					}
				}

猜你喜欢

转载自blog.csdn.net/lwzhang1101/article/details/130145871