Answers for "js get current top position event listeners"

0

js get current top position event listeners

const EPSILON = 0.5;

function setOverflow () {
  var firstDiv = document.querySelector('.first.subdiv');
  var secondDiv = document.querySelector('.second.subdiv');
  var rect = firstDiv.getBoundingClientRect();
  if (Math.abs(rect.top) < EPSILON) {
    secondDiv.style.overflow = 'scroll';
  }
  else {
    secondDiv.style.overflow = 'hidden';
  }
}
Posted by: Guest on August-27-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language