How to navigate to the current position of the append without pulling the scroll bar scrollIntoView method

Source: Internet
Author: User

1 var bb_mes_con = $ (' Bb_mes_con '); 2 var mes_html = document.createelement (' div '); 3 mes_html.setattribute (' id ', ' mes_html '); 4 mes_html.innerhtml = "<span class= ' bot ' ></span><span class= ' top ' ></span>" +  data; 5 Bb_mes_con.appendchild (mes_html); 6 Mes_html.scrollintoview ();

We insert elements into a div that has a overflow:auto set, and when we reach the height of the div we get a scroll bar, and we can quickly navigate to the current element with the scrollIntoView () method of the element. And do not need to get scrolltop settings scrolltop such things, scrollIntoView compatible IE6, so you can rest assured that the use of

How to navigate to the current position of append without pulling the scroll bar scrollIntoView method

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.