File tree 3 files changed +10
-4
lines changed
3 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -153,7 +153,7 @@ OverPack inherit Element; `component` `playScale` `onChange` `location` refer to
153
153
| onStartBack | function | - | scroll up animate start (playScale[ 1] ) callback; |
154
154
| onCompleteBack | function | - | scroll up animate completed (playScale[ 0] ) callback; |
155
155
156
- > animation = [ {},{}] 时为timeline ;
156
+ > animation = [ {},{}] is timeline ;
157
157
158
158
### Link
159
159
| name | type | default | description |
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " rc-scroll-anim" ,
3
- "version" : " 0.6.2 " ,
3
+ "version" : " 0.6.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 @@ -29,6 +29,7 @@ class ScrollParallax extends React.Component {
29
29
this . scrollTop = 0 ;
30
30
this . defaultTweenData = [ ] ;
31
31
this . defaultData = [ ] ;
32
+ this . timeout = null ;
32
33
this . state = { } ;
33
34
}
34
35
@@ -40,7 +41,7 @@ class ScrollParallax extends React.Component {
40
41
this . setDefaultData ( this . props . animation || { } ) ;
41
42
42
43
// 第一次进入;
43
- setTimeout ( ( ) => {
44
+ this . timeout = setTimeout ( ( ) => {
44
45
this . timeline = new Timeline ( this . dom , this . defaultTweenData ) ;
45
46
// 预注册;
46
47
this . timeline . frame ( 0 ) ;
@@ -62,7 +63,12 @@ class ScrollParallax extends React.Component {
62
63
}
63
64
64
65
componentWillUnmount ( ) {
65
- EventListener . removeEventListener ( this . eventType , this . scrollEventListener ) ;
66
+ if ( ! this . eventType && this . timeout ) {
67
+ clearTimeout ( this . timeout ) ;
68
+ this . timeout = null ;
69
+ } else {
70
+ EventListener . removeEventListener ( this . eventType , this . scrollEventListener ) ;
71
+ }
66
72
}
67
73
68
74
setDefaultData = _vars => {
You can’t perform that action at this time.
0 commit comments