Answers for "scroll past a div with JS"

0

scroll past a div with JS

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");
  }
});
Posted by: Guest on May-27-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language