[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

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

   1  /*!
   2   * jQuery UI Effects Scale 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: Scale Effect
  11  //>>group: Effects
  12  //>>description: Grows or shrinks an element and its content.
  13  //>>docs: http://api.jqueryui.com/scale-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              "./effect-size"
  26          ], factory );
  27      } else {
  28  
  29          // Browser globals
  30          factory( jQuery );
  31      }
  32  } )( function( $ ) {
  33  "use strict";
  34  
  35  return $.effects.define( "scale", function( options, done ) {
  36  
  37      // Create element
  38      var el = $( this ),
  39          mode = options.mode,
  40          percent = parseInt( options.percent, 10 ) ||
  41              ( parseInt( options.percent, 10 ) === 0 ? 0 : ( mode !== "effect" ? 0 : 100 ) ),
  42  
  43          newOptions = $.extend( true, {
  44              from: $.effects.scaledDimensions( el ),
  45              to: $.effects.scaledDimensions( el, percent, options.direction || "both" ),
  46              origin: options.origin || [ "middle", "center" ]
  47          }, options );
  48  
  49      // Fade option to support puff
  50      if ( options.fade ) {
  51          newOptions.from.opacity = 1;
  52          newOptions.to.opacity = 0;
  53      }
  54  
  55      $.effects.effect.size.call( this, newOptions, done );
  56  } );
  57  
  58  } );


Generated: Fri Apr 19 01:00:02 2024 Cross-referenced by PHPXref 0.7.1