如何获得Body元素的高度动态使用JQuery [英] How to get Body element height dynamically using JQuery
本文介绍了如何获得Body元素的高度动态使用JQuery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要得到body元素的高度和宽度,当我调整浏览器窗口
I need to get the body element height and width, when i resize the browser windows
请帮我解决使用JQuery这个问题。
Please help me to solve this problem using JQuery
推荐答案
窗口对象上使用resize事件:
Use the resize event on the window object:
$(window).resize(function(){
var width = $(document).width(), // or $(window).width()
height = $(document).height(); // or $(window).height()
});
这篇关于如何获得Body元素的高度动态使用JQuery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文