This repository was archived by the owner on Oct 8, 2021. It is now read-only.
File tree 1 file changed +8
-7
lines changed
1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,12 @@ define( [
49
49
$ . fn . animationComplete = function ( callback , type , fallbackTime ) {
50
50
var timer , duration ,
51
51
that = this ,
52
+ eventBinding = function ( ) {
53
+
54
+ // Clear the timer so we don't call callback twice
55
+ clearTimeout ( timer ) ;
56
+ callback . apply ( this , arguments ) ;
57
+ } ,
52
58
animationType = ( ! type || type === "animation" ) ? "animation" : "transition" ;
53
59
54
60
// Make sure selected type is supported by browser
@@ -76,17 +82,12 @@ define( [
76
82
77
83
// Sets up the fallback if event never comes
78
84
timer = setTimeout ( function ( ) {
79
- $ ( that ) . off ( props [ animationType ] . event ) ;
85
+ $ ( that ) . off ( props [ animationType ] . event , eventBinding ) ;
80
86
callback . apply ( that ) ;
81
87
} , duration ) ;
82
88
83
89
// Bind the event
84
- return $ ( this ) . one ( props [ animationType ] . event , function ( ) {
85
-
86
- // Clear the timer so we dont call callback twice
87
- clearTimeout ( timer ) ;
88
- callback . call ( this , arguments ) ;
89
- } ) ;
90
+ return $ ( this ) . one ( props [ animationType ] . event , eventBinding ) ;
90
91
} else {
91
92
92
93
// CSS animation / transitions not supported
You can’t perform that action at this time.
0 commit comments