| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
( function( factory ) { |
| 17 |
"use strict"; |
| 18 |
|
| 19 |
if ( typeof define === "function" && define.amd ) { |
| 20 |
|
| 21 |
|
| 22 |
define( [ |
| 23 |
"jquery", |
| 24 |
"../version", |
| 25 |
"../effect" |
| 26 |
], factory ); |
| 27 |
} else { |
| 28 |
|
| 29 |
|
| 30 |
factory( jQuery ); |
| 31 |
} |
| 32 |
} )( function( $ ) { |
| 33 |
"use strict"; |
| 34 |
|
| 35 |
return $.effects.define( "clip", "hide", function( options, done ) { |
| 36 |
var start, |
| 37 |
animate = {}, |
| 38 |
element = $( this ), |
| 39 |
direction = options.direction || "vertical", |
| 40 |
both = direction === "both", |
| 41 |
horizontal = both || direction === "horizontal", |
| 42 |
vertical = both || direction === "vertical"; |
| 43 |
|
| 44 |
start = element.cssClip(); |
| 45 |
animate.clip = { |
| 46 |
top: vertical ? ( start.bottom - start.top ) / 2 : start.top, |
| 47 |
right: horizontal ? ( start.right - start.left ) / 2 : start.right, |
| 48 |
bottom: vertical ? ( start.bottom - start.top ) / 2 : start.bottom, |
| 49 |
left: horizontal ? ( start.right - start.left ) / 2 : start.left |
| 50 |
}; |
| 51 |
|
| 52 |
$.effects.createPlaceholder( element ); |
| 53 |
|
| 54 |
if ( options.mode === "show" ) { |
| 55 |
element.cssClip( animate.clip ); |
| 56 |
animate.clip = start; |
| 57 |
} |
| 58 |
|
| 59 |
element.animate( animate, { |
| 60 |
queue: false, |
| 61 |
duration: options.duration, |
| 62 |
easing: options.easing, |
| 63 |
complete: done |
| 64 |
} ); |
| 65 |
|
| 66 |
} ); |
| 67 |
|
| 68 |
} ); |