checkDistance (elem){ let posElem = elem.getBoundingClientRect(); if(posElem.top > 0 && posElem.top < window.innerHeight ) elem.classList.add("act"); else elem.classList.remove("act"); }