@@ -72,7 +72,8 @@ class ScrollScreenClass {
7272 const t = this . scrollTop - startManyHeight ;
7373 tooNum = t > 0 ? Math . ceil ( t / winHeight ) : Math . floor ( t / winHeight ) ;
7474 this . num = tooNum ;
75- this . toHeight = startManyHeight + tooNum * winHeight ;
75+ const tc = Math . ceil ( startManyHeight / winHeight ) ;
76+ this . toHeight = ( tc + tooNum ) * winHeight ;
7677 }
7778 }
7879 }
@@ -115,7 +116,7 @@ class ScrollScreenClass {
115116 this . rafID = - 1 ;
116117 }
117118 getComputedStyle = ( dom ) => {
118- return document . defaultView && document . defaultView . getComputedStyle ?
119+ return dom && document . defaultView && document . defaultView . getComputedStyle ?
119120 document . defaultView . getComputedStyle ( dom ) : { } ;
120121 }
121122 isScroll = ( dom ) => {
@@ -124,7 +125,7 @@ class ScrollScreenClass {
124125 const overflowY = style . overflowY ;
125126 const isScrollOverflow = overflow === 'auto' || overflow === 'scroll' || overflow === 'overlay'
126127 || overflowY === 'auto' || overflowY === 'scroll' || overflowY === 'overlay' ;
127- if ( dom === document . body || dom === window ) {
128+ if ( dom === document . body || ! dom ) {
128129 return false ;
129130 } else if ( dom . scrollHeight > dom . offsetHeight
130131 && isScrollOverflow
@@ -171,7 +172,7 @@ class ScrollScreenClass {
171172 const manyScale = manyHeight ? Math . ceil ( manyHeight / winHeight ) : 0 ;
172173 this . limitNum ( - startManyScale , mapped . length - 1 + manyScale ) ;
173174 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 ;
175176 this . toHeight = this . toHeight < 0 ? 0 : this . toHeight ;
176177 this . toHeight = this . toHeight > docHeight - winHeight ?
177178 ( docHeight - winHeight ) : this . toHeight ;
0 commit comments