Full-stack JavaScript path (21) HTML5 scrollIntoView method, scrollintoview
In HTML5, scrollIntoView () can be called on all HTML elements
By rolling a browser window or a container element, the calling element can appear in the view.
If true is input as a parameter for this method, or no parameter is input, the top of the calling element and the top of the window are as close as possible after the window is rolled.
If false is input as a parameter, the calling element will appear in the viewport as much as possible (possibly, the bottom of the calling element will be equal to the top of the window .) However, the top is not necessarily equal.
When the page changes, this method is generally used to attract the user's attention.
In fact, setting focus for an element also causes the browser to scroll and display the element that gets the focus.
Browsers that support the scrollIntoView () method include IE, Firefox, Safari, and Opera.