How to know scroll to element is done in Javascript?
I am using Javascript method Element.scrollIntoView() https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView Is there any way I can get to know when the scroll is over. Say there was an animation, or I have set {behavior: smooth} . I am assuming scrolling is async and want to know if there is any callback like mechanism to it. You can use IntersectionObserver , check if element .isIntersecting at IntersectionObserver callback function const element = document.getElementById("box"); const intersectionObserver = new IntersectionObserver((entries) => { let [entry] = entries; if