Skip to content

Commit 1350e54

Browse files
committed
Merge branch 'effects-clean'
2 parents 2c81518 + d31dd18 commit 1350e54

File tree

1 file changed

+31
-26
lines changed

1 file changed

+31
-26
lines changed

ui/jquery.effects.clip.js

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,47 +17,52 @@ $.effects.effect.clip = function( o ) {
1717
return this.queue( function() {
1818

1919
// 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",
2828
animation = {},
2929
wrapper, animate, distance;
3030

3131
// Save & Show
32-
$.effects.save( el, props ); el.show();
32+
$.effects.save( el, props );
33+
el.show();
3334

3435
// Create Wrapper
35-
wrapper = $.effects.createWrapper( el ).css({
36-
overflow: 'hidden'
36+
wrapper = $.effects.createWrapper( el ).css({
37+
overflow: "hidden"
3738
});
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 ]();
4041

4142
// 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 );
4546
}
4647

4748
// 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;
5051

5152
// 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,
5657
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+
}
6166
el.dequeue();
6267
}
6368
});

0 commit comments

Comments
 (0)