获取屏幕的大小,当前网页和浏览器窗口 [英] Get the size of the screen, current web page and browser window
本文介绍了获取屏幕的大小,当前网页和浏览器窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何获得 windowWidth
, windowHeight
, pageWidth
, pageHeight
, screenWidth
, screenHeight
$ c> pageX ,,
pageY
, / code>这将在所有主流浏览器中使用?
How can I get windowWidth
, windowHeight
, pageWidth
, pageHeight
, screenWidth
, screenHeight
, pageX
, pageY
, screenX
, screenY
which will work in all major browsers?
推荐答案
如果你使用jQuery,你可以得到窗口大小或者使用jQuery方法的文档:
If you are using jQuery, you can get the size of the window or the document using jQuery methods:
$(window).height(); // returns height of browser viewport
$(document).height(); // returns height of HTML document
$(window).width(); // returns width of browser viewport
$(document).width(); // returns width of HTML document
对于屏幕尺寸,您可以使用屏幕
对象:
For screen size you can use the screen
object in the following way:
screen.height;
screen.width;
这篇关于获取屏幕的大小,当前网页和浏览器窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文