//调用方法
autodivheight();
function autodivheight(){ //函数:获取尺寸
//获取浏览器窗口高度
var winHeight=0;
if (window.innerHeight)
winHeight = window.innerHeight;
else if ((document.body) && (document.body.clientHeight))
winHeight = document.body.clientHeight;
//通过深入Document内部对body进行检测,获取浏览器窗口高度
if (document.documentElement && document.documentElement.clientHeight)
winHeight = document.documentElement.clientHeight;
//DIV高度为地图窗口的高度
var mapWrapper=document.getElementById("mapWrapper");
var mapHeight=mapWrapper.offsetHeight;//获取地图容器窗口高度
//内容高度
$("#mapcontainer").css("height", mapHeight+ "px");
//div高度等于浏览器窗体高度
//document.getElementById("mapContainer").style.height= winHeight +"px";
}
window.onresize=autodivheight; //浏览器窗口发生变化时同时变化DIV高度
用js实现地图窗体自适应不同的浏览器高度
猜你喜欢
转载自blog.csdn.net/wbx_wlg/article/details/78086865
今日推荐
周排行