2013-06-21 24 views

Trả lời

16

đây bạn đi:

var trueDivHeight = $('.someclass')[0].scrollHeight; 
var divHeight = $('.someclass').height(); 
var scrollLeft = trueDivHeight - divHeight; 
alert(scrollLeft); 

Giản

15

Dưới đây là một phiên bản đó chiếm padding và sử dụng prop thay vì truy cập các phần tử DOM trực tiếp.

$('#box').prop('scrollHeight') - $('#box').innerHeight(); 
0

nhìn ở đây một câu trả lời hoàn chỉnh:

https://stackoverflow.com/a/48246003/7668448

gì về việc sử dụng điều đó với jquery:

var max = $('#element')[0].scrollLeftMax; // when using the polyfill 
var max = $('#element')[0].scrollLeftMaxi(); // when using the other alternative more support IE6+ 
Các vấn đề liên quan