File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change 50
50
if (dir === ' top' ) {
51
51
distance = scrollTop;
52
52
} else {
53
- const elmBoundingClientRect = elm .getBoundingClientRect ();
54
- const scrollElmHeight = elm === window ?
55
- window .innerHeight :
56
- elmBoundingClientRect .height ;
57
- const elOffsetTopFromScrollElm = this .$el .getBoundingClientRect ().top -
58
- elmBoundingClientRect .top ;
53
+ let scrollElmHeight;
54
+ let elOffsetTopFromScrollElm;
55
+
56
+ if (elm === window ) {
57
+ scrollElmHeight = window .innerHeight ;
58
+ elOffsetTopFromScrollElm = this .$el .getBoundingClientRect ().top ;
59
+ } else {
60
+ scrollElmHeight = elm .getBoundingClientRect ().height ;
61
+ elOffsetTopFromScrollElm = this .$el .getBoundingClientRect ().top -
62
+ elm .getBoundingClientRect ().top ;
63
+ }
59
64
60
65
distance = elOffsetTopFromScrollElm - scrollTop - scrollElmHeight - (elm .offsetTop || 0 );
61
66
}
You can’t perform that action at this time.
0 commit comments