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 40
40
* @return {Number} distance
41
41
*/
42
42
function getCurrentDistance (elm ) {
43
+ const styles = getComputedStyle (elm === window ? document .body : elm);
43
44
const innerHeight = elm === window
44
45
? window .innerHeight
45
- : parseInt (getComputedStyle (elm) .height , 10 );
46
+ : parseInt (styles .height , 10 );
46
47
const scrollHeight = elm === window
47
48
? document .body .scrollHeight
48
49
: elm .scrollHeight ;
49
50
const scrollTop = isNaN (elm .scrollTop ) ? elm .pageYOffset : elm .scrollTop ;
51
+ const paddingTop = parseInt (styles .paddingTop , 10 );
52
+ const paddingBottom = parseInt (styles .paddingBottom , 10 );
50
53
51
- return scrollHeight - innerHeight - scrollTop;
54
+ return scrollHeight - innerHeight - scrollTop - paddingTop - paddingBottom ;
52
55
}
53
56
54
57
export default {
You can’t perform that action at this time.
0 commit comments