I propose some comments here.  Here's what I think makes sense based on my understanding of your revised code:

Avoid causing multiple reflows while manipulating the DOM.  Save the current scrollTop position off so we can detect and apply a delta at the end, meanwhile updating our running scrollTop as we go.