How To Retain Scroll Position After Reloading The Web-page Too?
$(document).ready(function(){ $('#addmedic').click(function(){ sessionStorage.setItem('pos', $('div').scrollTop()); }); }); $(document).ready(fun
Solution 1:
You can use session storage to store the position then get back to the position when the page is reloaded, like this:
$(window).scroll(function() {
sessionStorage.scrollTop = $(this).scrollTop();
});
$(document).ready(function() {
if (sessionStorage.scrollTop != "undefined") {
$(window).scrollTop(sessionStorage.scrollTop);
}
});
Post a Comment for "How To Retain Scroll Position After Reloading The Web-page Too?"