In order for the page to be transparently displayed in one place, you need to find out where the links are before loading in the new content.
var before = $(".links").offset().top;
Then, after loading the new content, get a link to the new height.
var after = $(".links").offset().top;
Then do the math to find out how much it moved.
var difference = after - before
And update the scroll location of the window accordingly
$(window).scrollTop( $(window).scrollTop() + difference )
Daniel Von Fange
source share