用JS或者jQuery监听 浏览器窗口大小的变化事件

$(window).resize(function () {          //当浏览器大小变化时

    alert($(window).height());          //浏览器时下窗口可视区域高度

    alert($(document).height());        //浏览器时下窗口文档的高度

    alert($(document.body).height());   //浏览器时下窗口文档body的高度

    alert($(document.body).outerHeight(true)); //浏览器时下窗口文档body的总高度 包括border padding margin

});

猜你喜欢

转载自blog.csdn.net/hss0123456789/article/details/88123720