jQuery
如果您使用的是jQuery,则可以使用jQuery方法获取窗口或document的大小:
/**
* 时间:2019年8月18日
* 前端教程: https://www.pipipi.net/
*/
$(window).height(); // returns height of browser viewport
$(document).height(); // returns height of HTML document (same as pageHeight in screenshot)
$(window).width(); // returns width of browser viewport
$(document).width(); // returns width of HTML document (same as pageWidth in screenshot)
对于屏幕大小你可以使用以下代码实现:
/**
* 时间:2019年8月18日
* 前端教程: https://www.pipipi.net/
*/
screen.height;
screen.width;
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。