@@ -72,7 +72,8 @@ class ScrollScreenClass {
72
72
const t = this . scrollTop - startManyHeight ;
73
73
tooNum = t > 0 ? Math . ceil ( t / winHeight ) : Math . floor ( t / winHeight ) ;
74
74
this . num = tooNum ;
75
- this . toHeight = startManyHeight + tooNum * winHeight ;
75
+ const tc = Math . ceil ( startManyHeight / winHeight ) ;
76
+ this . toHeight = ( tc + tooNum ) * winHeight ;
76
77
}
77
78
}
78
79
}
@@ -115,7 +116,7 @@ class ScrollScreenClass {
115
116
this . rafID = - 1 ;
116
117
}
117
118
getComputedStyle = ( dom ) => {
118
- return document . defaultView && document . defaultView . getComputedStyle ?
119
+ return dom && document . defaultView && document . defaultView . getComputedStyle ?
119
120
document . defaultView . getComputedStyle ( dom ) : { } ;
120
121
}
121
122
isScroll = ( dom ) => {
@@ -124,7 +125,7 @@ class ScrollScreenClass {
124
125
const overflowY = style . overflowY ;
125
126
const isScrollOverflow = overflow === 'auto' || overflow === 'scroll' || overflow === 'overlay'
126
127
|| overflowY === 'auto' || overflowY === 'scroll' || overflowY === 'overlay' ;
127
- if ( dom === document . body || dom === window ) {
128
+ if ( dom === document . body || ! dom ) {
128
129
return false ;
129
130
} else if ( dom . scrollHeight > dom . offsetHeight
130
131
&& isScrollOverflow
@@ -171,7 +172,7 @@ class ScrollScreenClass {
171
172
const manyScale = manyHeight ? Math . ceil ( manyHeight / winHeight ) : 0 ;
172
173
this . limitNum ( - startManyScale , mapped . length - 1 + manyScale ) ;
173
174
const currentDom = mapped [ this . num ] ;
174
- this . toHeight = currentDom ? currentDom . offsetTop : startManyHeight + this . num * winHeight ;
175
+ this . toHeight = currentDom ? currentDom . offsetTop : ( startManyScale + this . num ) * winHeight ;
175
176
this . toHeight = this . toHeight < 0 ? 0 : this . toHeight ;
176
177
this . toHeight = this . toHeight > docHeight - winHeight ?
177
178
( docHeight - winHeight ) : this . toHeight ;
0 commit comments