123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- ( function( factory ) {
- if ( typeof define === "function" && define.amd ) {
-
- define( [
- "jquery",
- "../version",
- "../effect"
- ], factory );
- } else {
-
- factory( jQuery );
- }
- }( function( $ ) {
- return $.effects.define( "drop", "hide", function( options, done ) {
- var distance,
- element = $( this ),
- mode = options.mode,
- show = mode === "show",
- direction = options.direction || "left",
- ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
- motion = ( direction === "up" || direction === "left" ) ? "-=" : "+=",
- oppositeMotion = ( motion === "+=" ) ? "-=" : "+=",
- animation = {
- opacity: 0
- };
- $.effects.createPlaceholder( element );
- distance = options.distance ||
- element[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ) / 2;
- animation[ ref ] = motion + distance;
- if ( show ) {
- element.css( animation );
- animation[ ref ] = oppositeMotion + distance;
- animation.opacity = 1;
- }
-
- element.animate( animation, {
- queue: false,
- duration: options.duration,
- easing: options.easing,
- complete: done
- } );
- } );
- } ) );
|