Utilizing the incredible plugin by lions-mark, scrolling to any desired position has become a simple task. I primarily use this feature to maintain the user's scroll location when the page is refreshed (due to the nature of my legacy gaming site which includes auto-refresh functionality in certain instances).
To achieve this, I save the current scroll position in the local storage using window.onBeforeUnload
, and then utilize that saved value to scroll back to the previous location upon page reload.
$('content-grid').scrollTo(offsetBeforeReload);
While this method works effectively, I am looking for a way to instantly "jump" to the desired position without the animated scroll effect. I prefer not to use anchors since the existing scrollTo code functions perfectly fine; all I want is to eliminate the animation and give the impression that the page is 'anchored' to that specific location.
I would greatly appreciate any suggestions or solutions related to this matter!