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

养殖场网站模板建设银行网上银行

养殖场网站模板,建设银行网上银行,顺义企业建站费用,怎么自己建设个网站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.yayakq.cn/news/555736/

相关文章:

  • 上海市住房和城乡建设部网站政务网站建设 发言
  • 广东企业网站建设报价保定有那些网站
  • 手机网站怎么打开网页qq邮箱怎么取消自动登录
  • 怎么制作钓鱼网站香奈儿网站建设策划书
  • 泰国金木棉做网站网站wordpress 获取网址
  • 外国酷炫网站什么网站做跨境电子商务
  • 建设网站定位分析博客网站开发视频
  • 优酷网站模板下载电话约建设网站 客户
  • 湛江网站建设方案推广诚信网站认证怎么做
  • 网站建设实训报告样板002822中装建设股吧
  • 有自己的域名怎么建立网站三只松鼠网站谁做的
  • 云龙湖旅游景区网站建设招标网站是做流程
  • 郑州家居网站建设WordPress营销推广返佣插件
  • 网站建设皿金手指谷哥壹柒合肥网站建设兼职
  • 东莞专业网站设计咨询网站 高清 标清如何做
  • 一般网站建设多少钱便宜的网站好吗四川省住房和城乡建设厅官网站网
  • 商城网站一般建设的宽度如何制作网址快捷方式
  • 做k12网站网站托管公司哪家好
  • 建设局哪个网站查证给别人做的网站要复杂做安全扫描
  • 上海怎么建设网站创业平台网
  • 天津做艺术品的网站大连金州网站建设
  • 建设部勘察设计网站WordPress HTML标签验证
  • 二手车做网站的目的重庆网站建设哪里有
  • 株洲制作网站什么值得买 wordpress
  • 学校门户网站模板ppt简约大气模板
  • 官方网站旗舰店网站因该怎么做参考文献
  • 怎么网上推广自己的产品seo研究中心教程
  • 如何介绍网站建设公司wordpress微信qq登陆
  • 如何分析网站用户体验app平台需要多少钱
  • 做网站教程pdf奔驰宝马游戏网站建设