[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

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

   1  /*!
   2   * jQuery UI Effects Pulsate 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: Pulsate Effect
  11  //>>group: Effects
  12  //>>description: Pulsates an element n times by changing the opacity to zero and back.
  13  //>>docs: http://api.jqueryui.com/pulsate-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( "pulsate", "show", function( options, done ) {
  35      var element = $( this ),
  36          mode = options.mode,
  37          show = mode === "show",
  38          hide = mode === "hide",
  39          showhide = show || hide,
  40  
  41          // Showing or hiding leaves off the "last" animation
  42          anims = ( ( options.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ),
  43          duration = options.duration / anims,
  44          animateTo = 0,
  45          i = 1,
  46          queuelen = element.queue().length;
  47  
  48      if ( show || !element.is( ":visible" ) ) {
  49          element.css( "opacity", 0 ).show();
  50          animateTo = 1;
  51      }
  52  
  53      // Anims - 1 opacity "toggles"
  54      for ( ; i < anims; i++ ) {
  55          element.animate( { opacity: animateTo }, duration, options.easing );
  56          animateTo = 1 - animateTo;
  57      }
  58  
  59      element.animate( { opacity: animateTo }, duration, options.easing );
  60  
  61      element.queue( done );
  62  
  63      $.effects.unshift( element, queuelen, anims + 1 );
  64  } );
  65  
  66  } );


Generated: Thu Nov 21 01:00:03 2024 Cross-referenced by PHPXref 0.7.1