如何确定滚动高度?

2024-02-20

如何使用 css Overflow:auto 确定分区的滚动高度?

我试过了:

$('test').scrollHeight();
$('test').height(); but that just returns the size of the div not all the content

最终,我尝试创建一个聊天,并始终将滚动条显示在屏幕上的当前消息。

所以我在想如下:

var test = $('test').height();
$('test').scrollTop(test);

谢谢你,

Brian


jQuery 中的正确方法是 -

  • $('#test').prop('scrollHeight') OR
  • $('#test')[0].scrollHeight OR
  • $('#test').get(0).scrollHeight
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何确定滚动高度? 的相关文章

随机推荐