Bri*_*ian 80 javascript jquery
如何确定分区的scrollHeight使用css overflow:auto?
我试过了:
$('test').scrollHeight();
$('test').height(); but that just returns the size of the div not all the content
Run Code Online (Sandbox Code Playgroud)
最终,我正在尝试创建一个聊天,并始终在屏幕上显示当前消息的滚动条.
所以我想的是以下内容:
var test = $('test').height();
$('test').scrollTop(test);
Run Code Online (Sandbox Code Playgroud)
谢谢,
布赖恩
Anm*_*raf 291
jQuery的正确方法是 -
$('#test').prop('scrollHeight')
要么$('#test')[0].scrollHeight
希望能帮助到你.
Den*_*nis 83
scrollHeight
是一个常规的JavaScript属性,所以你不需要jQuery.
var test = document.getElementById("foo").scrollHeight;
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
165829 次 |
最近记录: |