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

网站建设就业前景2017济南搜索引擎优化网站

网站建设就业前景2017,济南搜索引擎优化网站,开发商交房需要提供哪些证书,如何修改网站后台密码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.zhongyajixie.com/news/29406.html

相关文章:

  • 在线旅游网站开发分析报告网络服务投诉平台
  • 买了网站模版怎么做百度搜索关键词查询
  • 小型服务器做网站网站的seo是什么意思
  • 蓝色网站模板永久免费自助建站平台
  • 做张家界旅游网站多少钱全网推广网站
  • 怎样做安居客网站百度小说搜索排行榜
  • WordPress 手机版跳转网站排名优化师
  • 成都哪家网站建设强seo有哪些作用
  • wordpress全站加速宁波网站推广运营公司
  • 甘肃建设厅官方网站项目负责人免费python在线网站
  • 企业网站及信息化建设关键词seo是什么意思
  • 手机端网站制作教程网络广告营销方案策划内容
  • flash网站后台网络营销
  • 网站做tips最近一周的重大热点新闻
  • 做电脑网站手机能显示电商运营转行后悔了
  • 做网站用什么格式做好seo免费课程
  • zblog做微网站上海排名seo公司
  • 自己电脑做网站空间汕头seo建站
  • 私密浏览器免费观看在线视频下载广州seo排名外包
  • wordpress 绿色 炫 模板长沙网站优化方案
  • 有没有免费做物流推荐的网站seo推广教程seo推广技巧
  • 做分子生物实验常用网站网站外包
  • 无锡网站制作.武汉seo全网营销
  • 网站系统怎么做seo自动刷外链工具
  • 杭州外贸网站建设公司价格百度小说排行榜第一名
  • 网站建设优化服务器seo优化方案项目策划书
  • 中国建设银行网站查余额电商运营培训大概多少学费
  • 成都哪里有做网站建设的百度网站制作
  • dedecms医院网站怎么从网上找客户
  • 大型门户网站建设哪家好全国新冠疫苗接种率