1、scroll滚动(scrollTop、Left、Height、Width)

scroll()当用户滚动指定的元素时,会发生 scroll 滚动事件;

scrollWidth、scrollHeight属性表示元素对象真实的宽高;

scrollTop() 方法设置返回被选元素的垂直滚动条位置。当滚动条位于最顶部时,位置是 0。

scrollHeight-scrollTop=clientHeight;表示垂直滚动条走到底了(前提margin\padding都为0)

2、client 客户端(clientWidth、clientHeight)

浏览器的宽度:document.body.clientWidth;

3、offset偏移(offsetHeight、offsetWidth、offsetTop、offsetLeft)

offsetHeight、offsetWidth:表示当前对象的高、宽。

offsetTop、offsetLeft:表示当前元素对象相对于其定位元素的垂直、水平偏移量;

offset()可返回、可设置元素的偏移坐标

$(selector).offset():获取某元素当前的方位,返回偏移坐标;

$(selector).offset({top:value,left:value})设置偏移坐标

$(selector).offset().left 返回偏移坐标距离左边的位移

$(selector).offset($(selector).offset())使用另一元素的偏移坐标为元素设置偏移坐标

4、$(window).width();获取浏览器的宽度

$(window).height();获取浏览器的高度

$("#xx").width()/height()获取元素的宽度/高度

scrollHieght、offsetHeight、clientHeight、width、height的更多相关文章

  1. 四种浏览器对 clientHeight、offsetHeight、scrollHeight、clientWidth、offsetWidth 和 scrollWidth 的解释差异

    网页可见区域宽:document.body.clientWidth 网页可见区域高:document.body.clientHeight 网页可见区域宽:document.body.offsetWid ...

  2. 详解clientHeight、offsetHeight、scrollHeight

    关于clientHeight.offsetHeight.scrollHeight   window.screen.availWidth 返回当前屏幕宽度(空白空间)  window.screen.av ...

  3. clientHeight、offsetHeight、scrollHeight详解

    网页可见区域宽: document.body.clientWidth; 网页可见区域高: document.body.clientHeight; 网页可见区域宽: document.body.offs ...

  4. 关于height、offsetheight、clientheight、scrollheight、innerheight、outerheight的区别一览

    平时,不管在pc端页面还是移动端页面,因为我们一般很少会设置某个块的的高度,但是呢,我有时候有需要取到这些高度以便于我们方便进行判断和下一步的编写.一般这个时候我都是直接的获取一个块的高度.heigh ...

  5. JS中的offsetWidth、offsetHeight、clientWidth、clientHeight等等的详细介绍

    javascript中offsetWidth.clientWidth.width.scrollWidth.clientX.screenX.offsetX.pageX 原文:https://www.cn ...

  6. jquery 对象的 height、innerHeight、outerHeight 的区别以及DOM 元素的 clientHeight、offsetHeight、scrollHeight、offsetTop、scrollTop

    前言:jquery 对象的 height.innerHeight.outerHeight,还有 DOM 元素的 clientHeight.offsetHeight.scrollHeight.offse ...

  7. clientWidth、clientHeight、offsetWidth、offsetHeight以及scrollWidth、scrollHeight

    clientWidth.clientHeight.offsetWidth.offsetHeight以及scrollWidth.scrollHeight是几个困惑了好久的元素属性,趁着有时间整理一下 1 ...

  8. 浏览器中如何获取想要的offsetwidth、、、clientwidth、、offsetheight、、、clientheight。。。

    clientWidth是对象看到的宽度(不含边线,即border)scrollWidth是对象实际内容的宽度(若无padding,那就是边框之间距离,如有padding,就是左padding和右pad ...

  9. JS-scrollTop、scrollHeight、clientTop、clientHeight、offsetTop、offsetHeight的理解

    scrollTop, 可写(这些属性中唯一一个可写的元素) Element.scrollTop 属性可以获取或设置一个元素的内容垂直滚动的像素数. 一个元素的 scrollTop 值是这个元素的顶部到 ...

  10. 转 top、postop、scrolltop、offsetTop、scrollHeight、offsetHeight、clientHeight

    1.top 此属性仅仅在对象的定位(position)属性被设置时可用.否则,此属性设置会被忽略. 复制代码 代码如下: <div style=" position:absolute; ...

随机推荐

  1. SQL:bat批处理多个.sql文件

    一.批处理文件 update.bat       设置sqlserver的实例     记得一定要配置logfile文件 @echo off :: #### B. #### set LOGFILE=& ...

  2. dubbo事件通知机制 (2)

    此文已由作者赵计刚授权网易云社区发布. 欢迎访问网易云社区,了解更多网易技术产品运营经验. 142      * 反射执行xxxService.onthrow方法:至少要有一个入参且第一个入参类型为T ...

  3. 加快 hive 查询的 5 种方法

    1. 使用 Tez set hive.execution.engine=tez; 2. 使用 ORCFILE.当有多个表 join 时,使用 ORCFile 进行存储,会显著地提高速度. CREATE ...

  4. 选课 ( dp 树形dp 动态规划 树规)

    和某篇随笔重了?!!?!?!?!?!?不管了留着吧 题目: 在大学里每个学生,为了达到一定的学分,必须从很多课程里选择一些课程来学习,在课程里有些课程必须在某些课程之前学习,如高等数学总是在其它课程之 ...

  5. Leetcode 70. Climbing Stairs 爬楼梯 (递归,记忆化,动态规划)

    题目描述 要爬N阶楼梯,每次你可以走一阶或者两阶,问到N阶有多少种走法 测试样例 Input: 2 Output: 2 Explanation: 到第二阶有2种走法 1. 1 步 + 1 步 2. 2 ...

  6. php屏蔽错误消息

    定义和用法: error_reporting() 设置 PHP 的报错级别并返回当前级别. 函数语法: error_reporting(report_level) 如果参数 level 未指定,当前报 ...

  7. [USACO09FEB]改造路Revamping Trails 分层最短路 Dijkstra BZOJ 1579

    题意翻译 约翰一共有N)个牧场.由M条布满尘埃的小径连接.小径可 以双向通行.每天早上约翰从牧场1出发到牧场N去给奶牛检查身体. 通过每条小径都需要消耗一定的时间.约翰打算升级其中K条小径,使之成为高 ...

  8. Oracle11g 脚本创建表空间和用户

    /*分为四步 *//*第1步:创建临时表空间 */create temporary tablespace emaoyi_temp tempfile 'D:\app\Administrator\prod ...

  9. mysql 常用函数。。

    FIND_IN_SET(str,strlist) ,strlist 是 一个 由 逗号 分割的字符串,要注意 strlist 不能有逗号.. 它 等于  where str in (1,2,3***) ...

  10. maven 配置jetty 插件

    <plugin> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-maven-plugin ...