When you need to navigate within the page, such as returning to the top, window.scrollTo(0,0)
you can generally do it with one sentence.
However, I encountered a strange phenomenon recently. After refreshing, I scrolled to the top, and then the browser has a high probability of jumping back to the original position.
Tried the following methods (both delayed and combined execution):
window.scrollTo(0, 0);
window.scrollTo(0, Math.round(Math.random()*5));
$('html,body').scrollTop(0);
document.getElementById('ELEMENT_ID').scrollIntoView();
The special feature of this page is that it uses the interactive effect of sub-floor (that is, multiple UL lists) paging (by listening to the scroll event, gradually loading the list data), but if the sub-floor is not paging, or the single-floor paging, you can Jump to any position smoothly without jumping back.
I have searched the related questions and answers on stackoverflow , but have not been able to solve the problem.
to be solved.