jQuery尺寸相关、滚动事件

  1. 获取和设置元素的尺寸:

    width()、height() 获取元素width和height

    innerWidth()、innerHeight() 包括padding的width和height

    outerWidth()、outerHeight() 包括padding和border的widt和height

    outerWidth(true)、outerHeight(true) 包括padding和borde以及margin的width和height

  2. 获取元素相对页面的绝对位置:

    offset()

  3. 获取浏览器可视区宽度高度:

    $(window).width();

    $(window).height();

  4. 获取页面文档的宽度高度

    $(document).width();

    $(document).height();

  5. 获取页面滚动距离

    $(document).scrollTop();

    $(document).scrollLeft();

  6. 页面滚动事件

    $(window).scroll(function(){

    ……

    })

猜你喜欢

转载自blog.csdn.net/baidu_32656897/article/details/76922459