@@ -17,47 +17,52 @@ $.effects.effect.clip = function( o ) {
17
17
return this . queue ( function ( ) {
18
18
19
19
// Create element
20
- var el = $ ( this ) ,
21
- props = [ ' position' , ' top' , ' bottom' , ' left' , ' right' , ' height' , ' width' ] ,
22
- mode = $ . effects . setMode ( el , o . mode || ' hide' ) ,
23
- direction = o . direction || 'vertical' ,
24
- ref = {
25
- size : ( direction == ' vertical' ) ? 'height' : 'width' ,
26
- position : ( direction == 'vertical' ) ? 'top' : 'left'
27
- } ,
20
+ var el = $ ( this ) ,
21
+ props = [ " position" , " top" , " bottom" , " left" , " right" , " height" , " width" ] ,
22
+ mode = $ . effects . setMode ( el , o . mode || " hide" ) ,
23
+ show = mode === "show" ,
24
+ direction = o . direction || "vertical" ,
25
+ vert = direction === " vertical" ,
26
+ size = vert ? "height" : "width" ,
27
+ position = vert ? "top" : "left" ,
28
28
animation = { } ,
29
29
wrapper , animate , distance ;
30
30
31
31
// Save & Show
32
- $ . effects . save ( el , props ) ; el . show ( ) ;
32
+ $ . effects . save ( el , props ) ;
33
+ el . show ( ) ;
33
34
34
35
// Create Wrapper
35
- wrapper = $ . effects . createWrapper ( el ) . css ( {
36
- overflow : ' hidden'
36
+ wrapper = $ . effects . createWrapper ( el ) . css ( {
37
+ overflow : " hidden"
37
38
} ) ;
38
- animate = ( el [ 0 ] . tagName == ' IMG' ) ? wrapper : el ;
39
- distance = animate [ ref . size ] ( ) ;
39
+ animate = ( el [ 0 ] . tagName === " IMG" ) ? wrapper : el ;
40
+ distance = animate [ size ] ( ) ;
40
41
41
42
// Shift
42
- if ( mode == ' show' ) {
43
- animate . css ( ref . size , 0 ) ;
44
- animate . css ( ref . position , distance / 2 ) ;
43
+ if ( show ) {
44
+ animate . css ( size , 0 ) ;
45
+ animate . css ( position , distance / 2 ) ;
45
46
}
46
47
47
48
// Create Animation Object:
48
- animation [ ref . size ] = mode == ' show' ? distance : 0 ;
49
- animation [ ref . position ] = mode == ' show' ? 0 : distance / 2 ;
49
+ animation [ size ] = show ? distance : 0 ;
50
+ animation [ position ] = show ? 0 : distance / 2 ;
50
51
51
52
// Animate
52
- animate . animate ( animation , {
53
- queue : false ,
54
- duration : o . duration ,
55
- easing : o . easing ,
53
+ animate . animate ( animation , {
54
+ queue : false ,
55
+ duration : o . duration ,
56
+ easing : o . easing ,
56
57
complete : function ( ) {
57
- mode == 'hide' && el . hide ( ) ;
58
- $ . effects . restore ( el , props ) ;
59
- $ . effects . removeWrapper ( el ) ;
60
- $ . isFunction ( o . complete ) && o . complete . apply ( el [ 0 ] , arguments ) ;
58
+ if ( ! show ) {
59
+ el . hide ( ) ;
60
+ }
61
+ $ . effects . restore ( el , props ) ;
62
+ $ . effects . removeWrapper ( el ) ;
63
+ if ( $ . isFunction ( o . complete ) ) {
64
+ o . complete . apply ( el [ 0 ] , arguments ) ;
65
+ }
61
66
el . dequeue ( ) ;
62
67
}
63
68
} ) ;
0 commit comments