[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/js/jquery/ui/ -> effect-drop.js (source)

   1  /*!
   2   * jQuery UI Effects Drop 1.13.1
   3   * http://jqueryui.com
   4   *
   5   * Copyright jQuery Foundation and other contributors
   6   * Released under the MIT license.
   7   * http://jquery.org/license
   8   */
   9  
  10  //>>label: Drop Effect
  11  //>>group: Effects
  12  //>>description: Moves an element in one direction and hides it at the same time.
  13  //>>docs: http://api.jqueryui.com/drop-effect/
  14  //>>demos: http://jqueryui.com/effect/
  15  
  16  ( function( factory ) {
  17      "use strict";
  18  
  19      if ( typeof define === "function" && define.amd ) {
  20  
  21          // AMD. Register as an anonymous module.
  22          define( [
  23              "jquery",
  24              "./effect"
  25          ], factory );
  26      } else {
  27  
  28          // Browser globals
  29          factory( jQuery );
  30      }
  31  } )( function( $ ) {
  32  "use strict";
  33  
  34  return $.effects.define( "drop", "hide", function( options, done ) {
  35  
  36      var distance,
  37          element = $( this ),
  38          mode = options.mode,
  39          show = mode === "show",
  40          direction = options.direction || "left",
  41          ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
  42          motion = ( direction === "up" || direction === "left" ) ? "-=" : "+=",
  43          oppositeMotion = ( motion === "+=" ) ? "-=" : "+=",
  44          animation = {
  45              opacity: 0
  46          };
  47  
  48      $.effects.createPlaceholder( element );
  49  
  50      distance = options.distance ||
  51          element[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ) / 2;
  52  
  53      animation[ ref ] = motion + distance;
  54  
  55      if ( show ) {
  56          element.css( animation );
  57  
  58          animation[ ref ] = oppositeMotion + distance;
  59          animation.opacity = 1;
  60      }
  61  
  62      // Animate
  63      element.animate( animation, {
  64          queue: false,
  65          duration: options.duration,
  66          easing: options.easing,
  67          complete: done
  68      } );
  69  } );
  70  
  71  } );


Generated: Sun Dec 22 01:00:02 2024 Cross-referenced by PHPXref 0.7.1