As mentioned in the comments, the fact that the event will continue to shoot and register that the div is at the top is a natural result of pushing it out and then dragging quickly because the scroll bar has not been released. As far as I can see, there is no direct way to undo this interaction.
But without creating a custom scrollbar, this is probably the quickest fix, even if it's a minor hack:
Demo
var wrapper = document.getElementById('scroll-box'), size = wrapper.clientWidth; wrapper.addEventListener('scroll', function() { if (!wrapper.scrollTop) { console.log('top of frame'); wrapper.scrollTop += 500; wrapper.setAttribute('style', 'width: ' + size + 'px; overflow: hidden'); setTimeout(function() { wrapper.removeAttribute('style'); }, 0); } }); wrapper.scrollTop += 200;
Eliminate the scroll event by hiding the overflow for as little time as possible. And setting the clientWidth element so that it retains it in the original width so that the action is less noticeable.
source share