I have a page operation that uses something like:
$(\'#thetable tbody\').replaceWith(newtbody);
in an ajax callback. Sometimes, if the user
You could periodically check the div
outerHeight
, and set the scrollTop
property once the div
rendering has crossed the scroll value.
var g_Interval ;
var g_ScrollTop ;
function checkAndAdjustScroll() {
var height=$('#content').outerHeight() ;
if(height>g_ScrollTop) {
$(window).scrollTop(g_ScrollTop) ;
clearInterval(g_Interval) ;
}
}
And whenever you update your div with AJAX content, do this
g_ScrollTop=$(window).scrollTop() ;
g_Interval=setInterval(checkAndAdjustScroll, 100) ;
You might need to make adjustments based on the offset of your div
from the top of the page