Determine whether to slide to the bottom

Posted May 27, 20201 min read

let isScrollBottom = e.target.scrollHeight-(e.target.scrollTop + e.target.clientHeight + 1) <= 1
//The result is true is to scroll to the bottom
//e.target.scrollTop + e.target.clientHeight +1:The reason why 1 is added is to be compatible with different browser calculation results, sometimes it will be wrong by about 1px