I am reloading a specfic page . But after reloading it is jumping to the top of the page which i dont want . Is there any other way where i can jump to a specific section so that it scrolls by itself to that section after reloading.
CodePudding user response:
Js has a function document.location.reload()
which stores the position. You can add an additional true
parameter to force reload, but without restoring the position.
document.location.reload(true)
CodePudding user response:
Use location.href
with address hook instead of location.reload
Like this:
window.location.href = window.location.href '#my_hoock';
First content</br>
First content</br>
First content</br>
First content</br>
<div id="my_hoock">Div for show after reload</div>
Second content</br>
Second content</br>
Second content</br>
Second content</br>