📌  相关文章
📜  检测页面何时滚动到 div javascript no jquery - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:13.448000             🧑  作者: Mango

代码示例1
window.addEventListener("scroll", function() {
  var elementTarget = document.getElementById("section-2");
  if (window.scrollY > (elementTarget.offsetTop + elementTarget.offsetHeight)) {
      alert("You've scrolled past the second div");
  }
});