jcrollpane 或滚动 fpr Overflow-y 并使内容停留在面板底部
我希望主题行有意义。
我正在实时聊天支持区域工作。聊天区域的高度为 300 像素,我遇到一个问题,当聊天消息长度超过 300 像素时,垂直滚动条显示,每次客户或操作员输入消息时,它总是停留在顶部。
如果我可以用简单的 CSS 来完成它,我对使用 js 不是特别感兴趣。我能找到的更接近的示例是 jscrollpane,它显示了自动重新初始化示例,但我看到的结果与我拥有的简单的溢出-y 完全相同。 http://jscrollpane.kelvinluck.com/auto_reinitialise.html 我想知道是否无法使内容保留在面板底部(容器的底部)?
谢谢!
I hope the subject line makes sense.
I am working on a live chat support area. The chat area is 300px in height, I am having a problem, when the chat message is longer than 300px, while the vertical scroller shows up it always stay at the top each time when a message is entered either by customer or operator.
I am not particular interested in using js if I can get it done with simple CSS. The closer example I could find is jscrollpane which shows an automatic reinitialisation example, but the the result I see is exactly the same as with the simple overflow-y that I have.
http://jscrollpane.kelvinluck.com/auto_reinitialise.html
I wonder if it's not possible to make the make the content stays at panel bottom (bottom part of the container)?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您使用的是 jScrollPane 的最新版本,则可以传入一个
stickToBottom
设置。这将确保添加新内容时 jScrollPane 粘在底部(但前提是滚动窗格已经已滚动到底部 - 否则将永远无法滚动到其他地方)。我在这里整理了一个实际的演示:
http://jsfiddle.net/F9EsN/
If you are using a recent enough version of jScrollPane there is a
stickToBottom
setting you can pass in. This will ensure that the jScrollPane sticks to the bottom when new content is added (but only if the scrollpane has already been scrolled to the bottom - otherwise there would never be any way to scroll anywhere else).I put together a demo of it in action here:
http://jsfiddle.net/F9EsN/