your programing

scrollHeight를 어떻게 결정합니까?

lovepro 2020. 10. 8. 08:26
반응형

scrollHeight를 어떻게 결정합니까?


나누기의 scrollHeight를 어떻게 결정합니까? 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);

감사합니다,

브라이언


scrollHeight 일반 자바 스크립트 속성이므로 jQuery가 필요하지 않습니다.

var test = document.getElementById("foo").scrollHeight;

jQuery의 올바른 방법은 다음과 같습니다.

  • $('#test').prop('scrollHeight') 또는
  • $('#test')[0].scrollHeight

도움이되기를 바랍니다.

참고 URL : https://stackoverflow.com/questions/7381817/how-do-i-determine-scrollheight

반응형