you cannot βfreezeβ a scroll, but you can read and change the scroll position, especially because you use jQuery.
My solution is to keep the current scroll position immediately before the fadeIn statement, then reassign the same value immediately after this function:
function fadeInElement(id, time) { var currentScroll = $(window).scrollTop(); $('#' + id).fadeIn(time); $(window).scrollTop(currentScroll); }
Then you can call the same function several times with different identifiers and duration, for example:
fadeInElement('one', 500);
or that:
setTimeout(function() { fadeInElement('two', 500); }, 5000);
You can look at a working example in CodePen or on JSFiddle
source share