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 1
1
{
2
2
"name" : " rc-scroll-anim" ,
3
- "version" : " 2.7.2 " ,
3
+ "version" : " 2.7.3 " ,
4
4
"description" : " scroll-anim anim component for react" ,
5
5
"keywords" : [
6
6
" react" ,
Original file line number Diff line number Diff line change @@ -54,8 +54,11 @@ class ScrollScreenClass {
54
54
const domOffsetTop = dom . offsetTop ;
55
55
const domHeight = dom . getBoundingClientRect ( ) . height ;
56
56
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 ;
59
62
}
60
63
} ) ;
61
64
let tooNum ;
@@ -125,7 +128,8 @@ class ScrollScreenClass {
125
128
const overflowY = style . overflowY ;
126
129
const isScrollOverflow = overflow === 'auto' || overflow === 'scroll' || overflow === 'overlay'
127
130
|| 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 ) {
129
133
return false ;
130
134
} else if ( dom . scrollHeight > dom . offsetHeight
131
135
&& isScrollOverflow
You can’t perform that action at this time.
0 commit comments