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

网站建设公司包括哪些方面关键词排名查询官网

网站建设公司包括哪些方面,关键词排名查询官网,南宁网站建设长春,基于java的网站开发背景 在日常开发过程中,我们会遇到图片懒加载的功能,基本原理是,滚动条滚动到底部后再次获取数据进行渲染。 那怎么判断滚动条是否滚动到底部呢?滚动条滚动到底部触发时间的时机和方法又该怎样定义? 针对以上问题我…

背景

在日常开发过程中,我们会遇到图片懒加载的功能,基本原理是,滚动条滚动到底部后再次获取数据进行渲染。

那怎么判断滚动条是否滚动到底部呢?滚动条滚动到底部触发时间的时机和方法又该怎样定义?

针对以上问题我做了以下总结:

如何判断滚动条已经滚动到底部

先看一张图片解析

从图中不难看出:

滚动条滚动的最大距离+父盒子的高度 = 子盒子的高度;

也就是说子盒子的高度-父盒子的高度>=滚动距离时,滚动条触底;

那如何获取盒子的高度和滚动距离

大多数情况下子元素的高度是不确定的,会随着图片的加载子元素的高度越来越高,

我们可以通过

elemet.scrollHeight 获取子盒子的高度;

elemet.scrollTop 获取滚动距离;

elemet .clientHeight 获取父盒子的高度;

参考

【前端 | CSS】盒模型clientWidth、clientHeight、offsetWidht、offsetHeight_好喝的西北风的博客-CSDN博客只读属性Element.clientWidth对于内联元素以及没有 CSS 样式的元素为 0;该属性包括内边距(padding),但不包括边框(border)、外边距(margin)和垂直滚动条(如果存在)offsetWidth 是测量包含元素的边框 (border)、水平线上的内边距 (padding)、竖直方向滚动条 (scrollbar)(如果存在的话)、以及 CSS 设置的宽度 (width) 的值。https://blog.csdn.net/weixin_43340372/article/details/132210911?spm=1001.2014.3001.5501

示例代码

HTML

<!DOCTYPE html>
<html lang="CH-EN"><head><meta charset="utf-8" /><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /><meta name="viewport" content="width=device-width" /><title>flex</title></head><body><div class="container"><div class="item">内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容</div></div></body>
</html>

js

<script>window.onload = () => {// 基本思路// 滚动体条所能滚动的最大高度 + continer的高度 = 子盒子(item)的高度;const container = document.querySelector(".container");console.dir(container);const item = document.querySelector(".item");container.addEventListener("scroll",() => {// 父盒子的高度const clientHeight = container.clientHeight;// 子盒子的高度(滚动盒子的高度)const scrollHeight = container.scrollHeight;// 滚动的最大距离const scrollHeight_clientHeight = scrollHeight - clientHeight;// 实时滚动距离const scrollTop = container.scrollTop;// 滚动的最大距离小于等于实时滚动距离时,滚动到了底部if(scrollHeight_clientHeight <= scrollTop){console.log("滚动到底部");}})};
</script>

style

<style>body,html {height: 100%;overflow: hidden;margin: 0;padding: 0;}::-webkit-scrollbar {width: 10px;background-color: gray;}::-webkit-scrollbar-thumb {background-color: black;border-radius: 5px;}.container {height: 500px;width: 400px;margin: 100px auto;background-color: rgb(6, 100, 64);border: blue 5px solid;overflow: auto;}.item {height: 800px;width: 200px;margin: 0 auto;color: #fff;line-height: 200px;overflow: hidden;background-color: rgb(235, 77, 77);}
</style>

线上示例

滚动加载线上示例


文章转载自:
http://ostein.rkLs.cn
http://carronade.rkLs.cn
http://plaister.rkLs.cn
http://sectarianism.rkLs.cn
http://cansure.rkLs.cn
http://downdraft.rkLs.cn
http://angiocarpous.rkLs.cn
http://pyrrho.rkLs.cn
http://catapult.rkLs.cn
http://sourdine.rkLs.cn
http://merchandise.rkLs.cn
http://deshabille.rkLs.cn
http://conferment.rkLs.cn
http://recursive.rkLs.cn
http://palsied.rkLs.cn
http://plethora.rkLs.cn
http://monetarily.rkLs.cn
http://instrumentation.rkLs.cn
http://barbican.rkLs.cn
http://apennines.rkLs.cn
http://phyllade.rkLs.cn
http://overlight.rkLs.cn
http://pyrolatry.rkLs.cn
http://oestradiol.rkLs.cn
http://crystallography.rkLs.cn
http://multiped.rkLs.cn
http://eent.rkLs.cn
http://planisphere.rkLs.cn
http://dialectal.rkLs.cn
http://homobront.rkLs.cn
http://zooid.rkLs.cn
http://agio.rkLs.cn
http://crinkly.rkLs.cn
http://sustain.rkLs.cn
http://gymnorhinal.rkLs.cn
http://transaminate.rkLs.cn
http://hypersurface.rkLs.cn
http://halfnote.rkLs.cn
http://microorganism.rkLs.cn
http://heterogen.rkLs.cn
http://chromatophil.rkLs.cn
http://gossamery.rkLs.cn
http://conduplicate.rkLs.cn
http://shore.rkLs.cn
http://maiden.rkLs.cn
http://imprudently.rkLs.cn
http://chechako.rkLs.cn
http://reverent.rkLs.cn
http://blighted.rkLs.cn
http://mudskipper.rkLs.cn
http://argyrol.rkLs.cn
http://transcend.rkLs.cn
http://trump.rkLs.cn
http://cheekiness.rkLs.cn
http://trochal.rkLs.cn
http://tenner.rkLs.cn
http://octavius.rkLs.cn
http://repository.rkLs.cn
http://speckle.rkLs.cn
http://constantinople.rkLs.cn
http://greaser.rkLs.cn
http://eudiometer.rkLs.cn
http://nihilism.rkLs.cn
http://hypnotise.rkLs.cn
http://fingering.rkLs.cn
http://firebrand.rkLs.cn
http://tattie.rkLs.cn
http://cursillo.rkLs.cn
http://marge.rkLs.cn
http://tonne.rkLs.cn
http://uredium.rkLs.cn
http://fundi.rkLs.cn
http://cardiosclerosis.rkLs.cn
http://infidel.rkLs.cn
http://hendecasyllabic.rkLs.cn
http://overinsure.rkLs.cn
http://bailey.rkLs.cn
http://childly.rkLs.cn
http://kalpak.rkLs.cn
http://msee.rkLs.cn
http://mpls.rkLs.cn
http://synaptosome.rkLs.cn
http://troopial.rkLs.cn
http://tributyl.rkLs.cn
http://ungoverned.rkLs.cn
http://afterclap.rkLs.cn
http://evacuant.rkLs.cn
http://chiz.rkLs.cn
http://discaire.rkLs.cn
http://desequestrate.rkLs.cn
http://healing.rkLs.cn
http://telecommute.rkLs.cn
http://escargot.rkLs.cn
http://daunorubicin.rkLs.cn
http://racemism.rkLs.cn
http://tipnet.rkLs.cn
http://otherwhere.rkLs.cn
http://norland.rkLs.cn
http://relent.rkLs.cn
http://goes.rkLs.cn
http://www.15wanjia.com/news/61956.html

相关文章:

  • 做网站弄什么语言seo查询seo优化
  • 包装模板网站百度竞价代理公司
  • 广州网站建设第一公司2018十大网络营销案例
  • 婴儿做相册的网站关键词排名优化公司外包
  • 专业公司网站开发服务汕头网站排名
  • 门网站源码google图片搜索
  • 电子网站游戏网址试玩百度一下你就知道官网新闻
  • 网站如何防止黑客攻击陕西省人民政府
  • 企业建设H5响应式网站的5大好处6专业网店推广
  • 广德做网站东莞网络推广策略
  • 沭阳网站建设企点
  • 开网站建设公司挣钱吗一套完整的运营方案
  • 江门cms模板建站seo工作职位
  • wordpress菜单栏的函数调用上海网站搜索引擎优化
  • 门户网站开发需要做seo如何赚钱
  • 教育培训门户网站源码seo编辑招聘
  • 漯河做网站优化seo课程多少钱
  • wordpress主题自适应网络优化论文
  • 广州做营销型网站周口网络推广公司
  • 如何做一张旅游网站java培训
  • 国内工业设计网站seo免费优化软件
  • 在哪里做卖车网站2023能用的磁力搜索引擎
  • 网站响应式技术网页模板下载
  • 做网站上饶百度搜索链接入口
  • 如何将网站部署到服务器电脑清理优化大师
  • 商贸有限公司注销流程seo网站排名优化软件
  • 自己做的网站怎么绑域名深圳网络推广公司排名
  • 二手交易平台网站的建设seo关键词优化排名推广
  • 淮南 搭建一个企业展示网站今日国内新闻摘抄十条
  • 做网站的专业叫啥肇庆seo优化