scrolltop in js code example
Example 1: jquery keep scroll position
var scroll = $(window).scrollTop();
// yada
$("html").scrollTop(scroll);
Example 2: html scroll div to top
var myDiv = document.getElementById('containerDiv');
myDiv.innerHTML = variableLongText;
myDiv.scrollTop = 0;