| 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( "drop", "hide", function( options, done ) { |
| 36 |
|
| 37 |
var distance, |
| 38 |
element = $( this ), |
| 39 |
mode = options.mode, |
| 40 |
show = mode === "show", |
| 41 |
direction = options.direction || "left", |
| 42 |
ref = ( direction === "up" || direction === "down" ) ? "top" : "left", |
| 43 |
motion = ( direction === "up" || direction === "left" ) ? "-=" : "+=", |
| 44 |
oppositeMotion = ( motion === "+=" ) ? "-=" : "+=", |
| 45 |
animation = { |
| 46 |
opacity: 0 |
| 47 |
}; |
| 48 |
|
| 49 |
$.effects.createPlaceholder( element ); |
| 50 |
|
| 51 |
distance = options.distance || |
| 52 |
element[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ) / 2; |
| 53 |
|
| 54 |
animation[ ref ] = motion + distance; |
| 55 |
|
| 56 |
if ( show ) { |
| 57 |
element.css( animation ); |
| 58 |
|
| 59 |
animation[ ref ] = oppositeMotion + distance; |
| 60 |
animation.opacity = 1; |
| 61 |
} |
| 62 |
|
| 63 |
|
| 64 |
element.animate( animation, { |
| 65 |
queue: false, |
| 66 |
duration: options.duration, |
| 67 |
easing: options.easing, |
| 68 |
complete: done |
| 69 |
} ); |
| 70 |
} ); |
| 71 |
|
| 72 |
} ); |