且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

获取屏幕的大小,当前网页和浏览器窗口

更新时间:2023-01-27 20:36:12

如果你使用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;