[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

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

   1  /*!
   2   * jQuery UI Effects Fold 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: Fold Effect
  11  //>>group: Effects
  12  //>>description: Folds an element first horizontally and then vertically.
  13  //>>docs: http://api.jqueryui.com/fold-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( "fold", "hide", function( options, done ) {
  35  
  36      // Create element
  37      var element = $( this ),
  38          mode = options.mode,
  39          show = mode === "show",
  40          hide = mode === "hide",
  41          size = options.size || 15,
  42          percent = /([0-9]+)%/.exec( size ),
  43          horizFirst = !!options.horizFirst,
  44          ref = horizFirst ? [ "right", "bottom" ] : [ "bottom", "right" ],
  45          duration = options.duration / 2,
  46  
  47          placeholder = $.effects.createPlaceholder( element ),
  48  
  49          start = element.cssClip(),
  50          animation1 = { clip: $.extend( {}, start ) },
  51          animation2 = { clip: $.extend( {}, start ) },
  52  
  53          distance = [ start[ ref[ 0 ] ], start[ ref[ 1 ] ] ],
  54  
  55          queuelen = element.queue().length;
  56  
  57      if ( percent ) {
  58          size = parseInt( percent[ 1 ], 10 ) / 100 * distance[ hide ? 0 : 1 ];
  59      }
  60      animation1.clip[ ref[ 0 ] ] = size;
  61      animation2.clip[ ref[ 0 ] ] = size;
  62      animation2.clip[ ref[ 1 ] ] = 0;
  63  
  64      if ( show ) {
  65          element.cssClip( animation2.clip );
  66          if ( placeholder ) {
  67              placeholder.css( $.effects.clipToBox( animation2 ) );
  68          }
  69  
  70          animation2.clip = start;
  71      }
  72  
  73      // Animate
  74      element
  75          .queue( function( next ) {
  76              if ( placeholder ) {
  77                  placeholder
  78                      .animate( $.effects.clipToBox( animation1 ), duration, options.easing )
  79                      .animate( $.effects.clipToBox( animation2 ), duration, options.easing );
  80              }
  81  
  82              next();
  83          } )
  84          .animate( animation1, duration, options.easing )
  85          .animate( animation2, duration, options.easing )
  86          .queue( done );
  87  
  88      $.effects.unshift( element, queuelen, 4 );
  89  } );
  90  
  91  } );


Generated: Sat Apr 20 01:00:03 2024 Cross-referenced by PHPXref 0.7.1