![](/img/trans.png)
[英]How would I make my scroll bar automatically fix itself to to the bottom of a div?
[英]How would I make a div automatically scroll to the bottom?
你去了: http : //jsfiddle.net/tMnvJ/
只需將JavaScript代碼放在一個函數中,然后通過添加內容的任何進程調用它。 像這樣......
function addParagraph()
{
//do you add paragraph stuff...
//then call this line to scroll to the bottom of your div
document.getElementById('myDiv').scrollTop = document.getElementById('myDiv').scrollHeight;
}
希望有所幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.