[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

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

   1  /*!
   2   * jQuery UI Effects Slide 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: Slide Effect
  11  //>>group: Effects
  12  //>>description: Slides an element in and out of the viewport.
  13  //>>docs: http://api.jqueryui.com/slide-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( "slide", "show", function( options, done ) {
  35      var startClip, startRef,
  36          element = $( this ),
  37          map = {
  38              up: [ "bottom", "top" ],
  39              down: [ "top", "bottom" ],
  40              left: [ "right", "left" ],
  41              right: [ "left", "right" ]
  42          },
  43          mode = options.mode,
  44          direction = options.direction || "left",
  45          ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
  46          positiveMotion = ( direction === "up" || direction === "left" ),
  47          distance = options.distance ||
  48              element[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ),
  49          animation = {};
  50  
  51      $.effects.createPlaceholder( element );
  52  
  53      startClip = element.cssClip();
  54      startRef = element.position()[ ref ];
  55  
  56      // Define hide animation
  57      animation[ ref ] = ( positiveMotion ? -1 : 1 ) * distance + startRef;
  58      animation.clip = element.cssClip();
  59      animation.clip[ map[ direction ][ 1 ] ] = animation.clip[ map[ direction ][ 0 ] ];
  60  
  61      // Reverse the animation if we're showing
  62      if ( mode === "show" ) {
  63          element.cssClip( animation.clip );
  64          element.css( ref, animation[ ref ] );
  65          animation.clip = startClip;
  66          animation[ ref ] = startRef;
  67      }
  68  
  69      // Actually animate
  70      element.animate( animation, {
  71          queue: false,
  72          duration: options.duration,
  73          easing: options.easing,
  74          complete: done
  75      } );
  76  } );
  77  
  78  } );


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