ICode9

精准搜索请尝试: 精确搜索
  • 判断元素是否将要出现在可视区域 ele.getBoundingClientRect().top2022-06-24 02:31:50

    这种要实时监听.getBoundingClientRect().top <div></div> 1. 获取可视区域高度 height = document.body.offsetHeight 2. 获取元素距离浏览器 body 的 top border的距离 distanceBodyAbove = document.querySelector('div').getBoundingClientRect().top 如果height < distanceB

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有