Full-stack JavaScript path (21) HTML5 scrollIntoView method, scrollintoview

Source: Internet
Author: User

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.




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.