File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed
Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " rc-scroll-anim" ,
3- "version" : " 2.7.2 " ,
3+ "version" : " 2.7.3 " ,
44 "description" : " scroll-anim anim component for react" ,
55 "keywords" : [
66 " react" ,
Original file line number Diff line number Diff line change @@ -54,8 +54,11 @@ class ScrollScreenClass {
5454 const domOffsetTop = dom . offsetTop ;
5555 const domHeight = dom . getBoundingClientRect ( ) . height ;
5656 if ( this . scrollTop >= domOffsetTop && this . scrollTop < domOffsetTop + domHeight ) {
57- this . num = i ;
58- this . toHeight = domOffsetTop ;
57+ let exceed = ( this . scrollTop - dom . offsetTop ) / domHeight ;
58+ // 当前屏超过80%到下半屏, scrollOverPack 会动态改高度;
59+ exceed = exceed > 0.8 ? 1 : 0 ;
60+ this . num = i + exceed ;
61+ this . toHeight = domOffsetTop + exceed * domHeight ;
5962 }
6063 } ) ;
6164 let tooNum ;
@@ -125,7 +128,8 @@ class ScrollScreenClass {
125128 const overflowY = style . overflowY ;
126129 const isScrollOverflow = overflow === 'auto' || overflow === 'scroll' || overflow === 'overlay'
127130 || overflowY === 'auto' || overflowY === 'scroll' || overflowY === 'overlay' ;
128- if ( dom === document . body || ! dom ) {
131+ // dom.parentNode === document 解决在滚动条上滚动取不到 body;
132+ if ( dom === document . body || ! dom || dom . parentNode === document ) {
129133 return false ;
130134 } else if ( dom . scrollHeight > dom . offsetHeight
131135 && isScrollOverflow
You can’t perform that action at this time.
0 commit comments