本文介绍了如何确定scrollHeight?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何确定分部的scrollHeight使用css overflow:auto?
How do I determine scrollHeight of a division use css overflow:auto?
我试过:
$('test').scrollHeight();
$('test').height(); but that just returns the size of the div not all the content
最终,我正在尝试创建聊天并始终在屏幕上显示当前消息的滚动条。
Ultimately, I'm trying to create a chat and always have the scroll bar to the current message on the screen.
所以我想的是以下内容:
So I was thinking something like the following:
var test = $('test').height();
$('test').scrollTop(test);
谢谢,
Brian
推荐答案
是一个常规的javascript属性,所以你不需要jQuery。
scrollHeight
is a regular javascript property so you don't need jQuery.
var test = document.getElementById("foo").scrollHeight;
这篇关于如何确定scrollHeight?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!