Now most websites will add this function: when the scroll bar scrolls to the bottom of the page, a "back to top" button or link will be displayed in the lower right corner of the page. After clicking the button, the page will jump to the top, or A suitable location for viewing the content.
So, how to control the display or hiding of the "Back to Top" button? In fact, we only need to implement the window.onscroll event. The code is as follows: