The iframe scroll bar is at the bottom by default. It is used as a chat tool. When there is a large amount of data, the upstream and downstream scrolling appears at each refresh is at the top by default. You need to drop it down to see the chat record, this article will introduce, as shown in and below
Problem: How does the iframe scroll bar appear below by default? It is a chat tool with a large amount of data. Each time you refresh the page, the scroll up and down appears at the top by default. You need to drop down the page to view the chat record, is there a way to make it appear below?
Answer: directly write window. scrollTo (9999999) in iframe or set scrollTop for containers such as p.
The Code is as follows:
Document. getElementById ("x"). scrollTop = document. getElementById ("x"). scrollHeight
Window. scrollTo)
This is solved at the bottom, but after there is new information, the scroll bar will not automatically go to the bottom, I want to have new content like the QQ chat window, automatically to the bottom, how can this problem be solved?
Then we should determine the position of the currently generated content, that is, its top or margin-top, and then set the height of the scroll bar, the height of the scroll bar changes every time it is generated. After the new data is obtained, the window is called again. scrollTo (9999999) can solve this problem!