File tree 1 file changed +7
-7
lines changed
1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change 46
46
*/
47
47
function getCurrentDistance (elm , dir ) {
48
48
let distance;
49
- const scrollTop = isNaN ( elm . scrollTop ) ? elm . pageYOffset : elm . scrollTop ;
49
+
50
50
if (dir === ' top' ) {
51
- distance = scrollTop;
51
+ distance = isNaN ( elm . scrollTop ) ? elm . pageYOffset : elm . scrollTop ;
52
52
} else {
53
53
let scrollElmHeight;
54
- let elOffsetTopFromScrollElm = this .$el .getBoundingClientRect ().top ;
54
+ let elOffsetTop = this .$el .getBoundingClientRect ().top ;
55
55
56
56
if (elm === window ) {
57
57
scrollElmHeight = window .innerHeight ;
58
58
} else {
59
- scrollElmHeight = elm .getBoundingClientRect (). height ;
60
- elOffsetTopFromScrollElm -= elm .getBoundingClientRect ().top ;
59
+ scrollElmHeight = elm .clientHeight ;
60
+ elOffsetTop -= elm .getBoundingClientRect ().top ;
61
61
}
62
-
63
- distance = elOffsetTopFromScrollElm - scrollElmHeight - (elm .offsetTop || 0 );
62
+ distance = elOffsetTop - scrollElmHeight;
64
63
}
64
+
65
65
return distance;
66
66
}
67
67
You can’t perform that action at this time.
0 commit comments