File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 4040 * @return {Number} distance
4141 */
4242 function getCurrentDistance (elm ) {
43+ const styles = getComputedStyle (elm);
4344 const innerHeight = elm === window
4445 ? window .innerHeight
45- : parseInt (getComputedStyle (elm) .height , 10 );
46+ : parseInt (styles .height , 10 );
4647 const scrollHeight = elm === window
4748 ? document .body .scrollHeight
4849 : elm .scrollHeight ;
4950 const scrollTop = isNaN (elm .scrollTop ) ? elm .pageYOffset : elm .scrollTop ;
51+ const paddingTop = parseInt (styles .paddingTop , 10 );
52+ const paddingBottom = parseInt (styles .paddingBottom , 10 );
5053
51- return scrollHeight - innerHeight - scrollTop;
54+ return scrollHeight - innerHeight - scrollTop - paddingTop - paddingBottom ;
5255 }
5356
5457 export default {
You can’t perform that action at this time.
0 commit comments