| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
(function( $, undefined ) { |
| 15 |
|
| 16 |
$.effects.effect.clip = function( o, done ) { |
| 17 |
|
| 18 |
var el = $( this ), |
| 19 |
props = [ "position", "top", "bottom", "left", "right", "height", "width" ], |
| 20 |
mode = $.effects.setMode( el, o.mode || "hide" ), |
| 21 |
show = mode === "show", |
| 22 |
direction = o.direction || "vertical", |
| 23 |
vert = direction === "vertical", |
| 24 |
size = vert ? "height" : "width", |
| 25 |
position = vert ? "top" : "left", |
| 26 |
animation = {}, |
| 27 |
wrapper, animate, distance; |
| 28 |
|
| 29 |
|
| 30 |
$.effects.save( el, props ); |
| 31 |
el.show(); |
| 32 |
|
| 33 |
|
| 34 |
wrapper = $.effects.createWrapper( el ).css({ |
| 35 |
overflow: "hidden" |
| 36 |
}); |
| 37 |
animate = ( el[0].tagName === "IMG" ) ? wrapper : el; |
| 38 |
distance = animate[ size ](); |
| 39 |
|
| 40 |
|
| 41 |
if ( show ) { |
| 42 |
animate.css( size, 0 ); |
| 43 |
animate.css( position, distance / 2 ); |
| 44 |
} |
| 45 |
|
| 46 |
|
| 47 |
animation[ size ] = show ? distance : 0; |
| 48 |
animation[ position ] = show ? 0 : distance / 2; |
| 49 |
|
| 50 |
|
| 51 |
animate.animate( animation, { |
| 52 |
queue: false, |
| 53 |
duration: o.duration, |
| 54 |
easing: o.easing, |
| 55 |
complete: function() { |
| 56 |
if ( !show ) { |
| 57 |
el.hide(); |
| 58 |
} |
| 59 |
$.effects.restore( el, props ); |
| 60 |
$.effects.removeWrapper( el ); |
| 61 |
done(); |
| 62 |
} |
| 63 |
}); |
| 64 |
|
| 65 |
}; |
| 66 |
|
| 67 |
})(jQuery); |