javascript:控制一个元素高度始终等于浏览器高度

window.onresize = function(){
this.opHtight()
}

//给浏览器添加窗口大小改变事件
window.onresize = function(){
this.opHtight()
}


opHtight(){
var h=document.documentElement.clientHeight;//可见区域高度
var allmapBox = document.getElementById('allmap');
allmapBox.style.height=h+"px";
},

猜你喜欢

转载自www.cnblogs.com/llqwm/p/9267175.html