当前位置: 首页 > news >正文

网站建设就业前景2017b站推广入口2023

网站建设就业前景2017,b站推广入口2023,青海 网站开发 app,企业免费网站注册Scroll 系列属性 scrollTop & scrollLeft scrollTop: 返回元素的内容已向上滚动的部分的高度。scrollLeft: 返回元素的内容已向左滚动的部分的宽度。 scrollHeight & scrollWidth scrollHeight: 返回元素的实际高度,包括由于溢出而在屏幕上不可见的内容…

Scroll 系列属性

scrollTop & scrollLeft

  1. scrollTop: 返回元素的内容已向上滚动的部分的高度。
  2. scrollLeft: 返回元素的内容已向左滚动的部分的宽度。

scrollHeight & scrollWidth

  1. scrollHeight: 返回元素的实际高度,包括由于溢出而在屏幕上不可见的内容。
  2. scrollWidth: 返回元素的实际宽度,包括由于溢出而在屏幕上不可见的内容。
<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>Scroll Properties Example</title><style>#container {width: 200px;height: 200px;overflow: auto;border: 1px solid black;}.content {width: 300px;height: 300px;}</style>
</head>
<body><div id="container"><div class="content"></div></div><button onclick="logScrollProperties()">Log Scroll Properties</button><script>function logScrollProperties() {const container = document.getElementById('container');console.log(`scrollTop: ${container.scrollTop}`);console.log(`scrollLeft: ${container.scrollLeft}`);console.log(`scrollHeight: ${container.scrollHeight}`);console.log(`scrollWidth: ${container.scrollWidth}`);}// 示例:自动滚动到底部setTimeout(() => {const container = document.getElementById('container');container.scrollTop = container.scrollHeight;container.scrollLeft = container.scrollWidth;}, 2000);</script>
</body>
</html>

Offset 系列属性

offsetTop & offsetLeft

  1. offsetTop: 元素相对于最近的定位祖先元素(position != static)顶部的距离。如果没有这样的祖先,则相对于初始包含块(通常是视口)
  2. offsetLeft: 元素相对于最近的定位祖先元素左侧的距离。如果没有这样的祖先,则相对于初始包含块。

offsetParent

  1. offsetParent: 返回一个指向最近的设置了 position 属性(除了static之外)的祖先元素。如果没有这样的祖先,则返回 null 或者 <body> 元素。

offsetHeight & offsetWidth

  1. offsetHeight: 包括 content + padding + border 的总高度。
  2. offsetWidth: 包括 content + padding + border 的总宽度。
<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>Offset Properties Example</title><style>#outer {position: relative;top: 50px;left: 50px;width: 200px;height: 200px;background-color: lightblue;}#inner {position: absolute;top: 20px;left: 20px;width: 100px;height: 100px;background-color: yellow;}</style>
</head>
<body><div id="outer">Outer Div<div id="inner">Inner Div</div></div><button onclick="logOffsetProperties()">Log Offset Properties</button><script>function logOffsetProperties() {const outer = document.getElementById('outer');const inner = document.getElementById('inner');console.log(`Outer div's offsetTop: ${outer.offsetTop}, offsetLeft: ${outer.offsetLeft}`);console.log(`Inner div's offsetTop: ${inner.offsetTop}, offsetLeft: ${inner.offsetLeft}`);console.log(`Outer div's offsetHeight: ${outer.offsetHeight}, offsetWidth: ${outer.offsetWidth}`);console.log(`Inner div's offsetHeight: ${inner.offsetHeight}, offsetWidth: ${inner.offsetWidth}`);console.log(`Inner div's offsetParent: `, inner.offsetParent);}</script>
</body>
</html>

Client 系列属性

clientTop & clientLeft

  1. clientTop: 边框的厚度(上边框),不包括外边距、内填充或水平滚动条
  2. clientLeft: 左侧边框的厚度。

clientHeight & clientWidth

  1. clientHeight: 可见区域的高度,包括内填充不包括边框、外边距或水平滚动条
  2. clientWidth: 可见区域的宽度,包括内填充但不包括边框、外边距或垂直滚动条。
<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>Client Properties Example</title><style>#element {width: 200px;height: 200px;margin: 20px;padding: 10px;border: 5px solid red;overflow-y: scroll;}</style>
</head>
<body><div id="element">Some long text here... Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</div><button onclick="logClientProperties()">Log Client Properties</button><script>function logClientProperties() {const element = document.getElementById('element');console.log(`clientTop: ${element.clientTop}`); // Border thickness (top)console.log(`clientLeft: ${element.clientLeft}`); // Border thickness (left)console.log(`clientHeight: ${element.clientHeight}`); // Visible area including padding but excluding borders and scrollbarconsole.log(`clientWidth: ${element.clientWidth}`); // Same logic applies horizontally}</script>
</body>
</html>

总结

scrollscrollTop元素内容垂直滚动的像素数。
scrollLeft元素内容水平滚动的像素数。
scrollHeight元素内容的总高度,括在视口中不可见的部分。
scrollWidth元素内容的总宽度,包括在视口中不可见的部分。
offsetoffsetTop元素顶部相对于包含元素的顶部的距离。
offsetLeft元素左边缘相对于包含元素左边缘的距离。
offsetHeight元素的高度,包括边框和内边距
offsetWidth元素的宽度,包括边框和内边距。
clientclientTop元素的上边框的宽度。
clientLeft元素的左边框的宽度。
clientHeight元素的内部高度,不包括水平滚动条高度。
clientWidth元素的内部宽度,不包括垂直滚动条宽度。
http://www.hengruixuexiao.com/news/25348.html

相关文章:

  • ps做的网站模板网店代运营商
  • 永久建站空间购买广告投放公司
  • 网站开发报价表的文档人员优化方案
  • 做网站的费用属于什么费用网站的营销推广
  • APP客户端网站建设适合员工的培训课程
  • 海外网购网站网络项目怎么推广
  • c 网站开发技术seo网站排名
  • 黄页网站怎么做 获取企业信息专业技能培训机构
  • 网站做自签发证书莫停之科技windows优化大师
  • 系统开发是系统建设中工作任务最为繁重的阶段seo顾问培训
  • 静态网站html模板下载淘宝app官方下载
  • 兰考县红庙关东村做网站的百度小说排行榜前十
  • 宝山网站建设教育培训报名
  • 山东网站优化公司南宁seo外包要求
  • 网页图片显示不出来手机系统优化工具
  • 网站中搜索栏怎么做西安seo招聘
  • python网站开发实例教程重庆快速排名优化
  • 深圳有哪些做网站的公司软文推广经典案例
  • 电商网站推广怎么做公众号运营收费价格表
  • 免费网站软件制作郑州企业网站优化排名
  • 网站优化吧全媒体广告代理加盟靠谱吗
  • 美女做恐怖手术视频网站搜索引擎提交入口大全
  • 网站建设营销型号的区别相似图片在线查找
  • 聊城网站制作公司北京百度网讯人工客服电话
  • 做网站费用会计分录怎么做seo网站分析报告
  • 吉林长春有做网站的吗东莞市网络seo推广价格
  • 网站优化及推广公司企业营销策略分析论文
  • 东莞网站设计的公司百度服务中心人工客服
  • 店面设计要素南京百度搜索优化
  • 做网站时怎么裁切存图抖音推广怎么做