¿Cómo determino el scrollHeight de una división usando css overflow: auto?
He intentado:
$('test').scrollHeight();
$('test').height(); but that just returns the size of the div not all the content
En última instancia, estoy tratando de crear un chat y siempre tengo la barra de desplazamiento al mensaje actual en la pantalla.
Entonces estaba pensando en algo como lo siguiente:
var test = $('test').height();
$('test').scrollTop(test);
Gracias,
Brian
javascript
jquery
Brian
fuente
fuente

scrollHeight()función en jQuery.Respuestas:
scrollHeightes una propiedad de JavaScript normal, por lo que no necesita jQuery.fuente
Las formas correctas en jQuery son:
$('#test').prop('scrollHeight')O$('#test')[0].scrollHeightO$('#test').get(0).scrollHeightEspero eso ayude.
fuente
propmétodo requiere jquery versión 1.6 o superior. +1 de mí