document.scrollTop code example
Example 1: jquery get document scrolltop
var top = ($(window).scrollTop() || $("body").scrollTop());
Example 2: html scroll div to top
var myDiv = document.getElementById('containerDiv');
myDiv.innerHTML = variableLongText;
myDiv.scrollTop = 0;