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

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;
(0)
上一篇 2019年8月18日 下午4:06
下一篇 2019年8月18日 下午10:43

相关推荐

发表评论

登录后才能评论