[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

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

   1  /*!
   2   * jQuery UI Effects Clip 1.13.3
   3   * https://jqueryui.com
   4   *
   5   * Copyright OpenJS Foundation and other contributors
   6   * Released under the MIT license.
   7   * https://jquery.org/license
   8   */
   9  
  10  //>>label: Clip Effect
  11  //>>group: Effects
  12  //>>description: Clips the element on and off like an old TV.
  13  //>>docs: https://api.jqueryui.com/clip-effect/
  14  //>>demos: https://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              "../version",
  25              "../effect"
  26          ], factory );
  27      } else {
  28  
  29          // Browser globals
  30          factory( jQuery );
  31      }
  32  } )( function( $ ) {
  33  "use strict";
  34  
  35  return $.effects.define( "clip", "hide", function( options, done ) {
  36      var start,
  37          animate = {},
  38          element = $( this ),
  39          direction = options.direction || "vertical",
  40          both = direction === "both",
  41          horizontal = both || direction === "horizontal",
  42          vertical = both || direction === "vertical";
  43  
  44      start = element.cssClip();
  45      animate.clip = {
  46          top: vertical ? ( start.bottom - start.top ) / 2 : start.top,
  47          right: horizontal ? ( start.right - start.left ) / 2 : start.right,
  48          bottom: vertical ? ( start.bottom - start.top ) / 2 : start.bottom,
  49          left: horizontal ? ( start.right - start.left ) / 2 : start.left
  50      };
  51  
  52      $.effects.createPlaceholder( element );
  53  
  54      if ( options.mode === "show" ) {
  55          element.cssClip( animate.clip );
  56          animate.clip = start;
  57      }
  58  
  59      element.animate( animate, {
  60          queue: false,
  61          duration: options.duration,
  62          easing: options.easing,
  63          complete: done
  64      } );
  65  
  66  } );
  67  
  68  } );


Generated : Tue Dec 17 08:20:01 2024 Cross-referenced by PHPXref