问题:
I am creating a chat using ajax requests in rails and I'm trying to get a div to scroll to the bottom without much luck. 我正在使用Rails中的Ajax请求创建聊天,并且试图使div滚动到底部没有太多运气。
I am wrapping everything in this div: 我将所有内容包装在这个div中:
#scroll {
height:400px;
overflow:scroll;
}
Is there a way to keep it scrolled to the bottom by default using JS? 有没有一种方法可以使用JS将其默认滚动到底部?
Is there a way to keep it scrolled to the bottom after an ajax request? 是否有办法在ajax请求后将其滚动到底部?
解决方案:
参考一: https://stackoom.com/question/18Oi/滚动到div的底部参考二: https://oldbug.net/q/18Oi/Scroll-to-bottom-of-div
来源:oschina
链接:https://my.oschina.net/u/3797416/blog/4254476