xiaoqi2018

原生JS各种获取当前窗口页面宽度、高度的方法

alert($(window).height()); //浏览器时下窗口可视区域高度
alert($(document).height()); //浏览器时下窗口文档的高度
alert($(document.body).height());//浏览器时下窗口文档body的高度
alert($(document.body).outerHeight(true));//浏览器时下窗口文档body的总高度
alert($(window).width()); //浏览器时下窗口可视区域宽度
alert($(document).width());//浏览器时下窗口文档对于象宽度
alert($(document.body).width());//浏览器时下窗口文档body的高度
alert($(document.body).outerWidth(true));//浏览器时下窗口文档body的总宽度
alert($(document).scrollTop()); //获取滚动条到顶部的垂直高度
alert($(document).scrollLeft()); //获取滚动条到左边的垂直宽度

 

分类:

技术点:

相关文章:

  • 2021-11-27
  • 2021-11-27
  • 2021-11-30
  • 2021-11-18
  • 2021-12-26
  • 2022-01-09
猜你喜欢
  • 2021-12-10
  • 2021-11-30
  • 2021-11-20
  • 2021-12-15
  • 2022-02-18
相关资源
相似解决方案