如何获取windowWidth
、windowHeight
、pageWidth
、pageHeight
、screenWidth
>, screenHeight
, pageX
, pageY
, screenX
, screenY
可以在所有主要浏览器?
最佳答案
您可以使用 jQuery 获取窗口或文档的大小:
// Size of browser viewport.
$(window).height();
$(window).width();
// Size of HTML document (same as pageHeight/pageWidth in screenshot).
$(document).height();
$(document).width();
对于屏幕尺寸,您可以使用 screen
对象:
window.screen.height;
window.screen.width;
关于javascript - 获取屏幕、当前网页和浏览器窗口的大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38094312/