Finding the maximum bottom value of scrollTop on a div?

前端 未结 4 1085
旧巷少年郎
旧巷少年郎 2020-12-29 05:23

I need a way to automatically find the maximum bottom value of scrollTop, of the div id \"#box\".

Something like this: How to get maximum document scrolltop value

4条回答
  •  既然无缘
    2020-12-29 05:55

    Here's a version that accounts for padding and uses prop instead of accessing the DOM element directly.

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

提交回复
热议问题