What is the best way to detect when scrolling to an element on the page has finished? The spec says that \"The scrolling box is scrolled in a smooth fashion using a user-agent-d
Maybe I'm not understanding the question, but why not just detect when the element you're scrolling to has come to its final position relative to the top to the viewport...
var scrollElem = document.querySelector('.scroll-me'),
offsetTop = 300;
window.addEventListener('scroll', checkScroll);
document.addEventListener("DOMContentLoaded", checkScroll)
function checkScroll() {
var viewportOffset = scrollElem.getBoundingClientRect(),
distanceToTop = viewportOffset.top;
if (distanceToTop <= offsetTop) {
callback();
}
}