standard header in about page (#676)
[openemr.git] / public / assets / jquery-ui-1-12-1 / ui / effects / effect-bounce.js
blob1a6304906ebcc051083e638053995d7955c13b77
1 /*!
2  * jQuery UI Effects Bounce 1.12.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  */
10 //>>label: Bounce Effect
11 //>>group: Effects
12 //>>description: Bounces an element horizontally or vertically n times.
13 //>>docs: http://api.jqueryui.com/bounce-effect/
14 //>>demos: http://jqueryui.com/effect/
16 ( function( factory ) {
17         if ( typeof define === "function" && define.amd ) {
19                 // AMD. Register as an anonymous module.
20                 define( [
21                         "jquery",
22                         "../version",
23                         "../effect"
24                 ], factory );
25         } else {
27                 // Browser globals
28                 factory( jQuery );
29         }
30 }( function( $ ) {
32 return $.effects.define( "bounce", function( options, done ) {
33         var upAnim, downAnim, refValue,
34                 element = $( this ),
36                 // Defaults:
37                 mode = options.mode,
38                 hide = mode === "hide",
39                 show = mode === "show",
40                 direction = options.direction || "up",
41                 distance = options.distance,
42                 times = options.times || 5,
44                 // Number of internal animations
45                 anims = times * 2 + ( show || hide ? 1 : 0 ),
46                 speed = options.duration / anims,
47                 easing = options.easing,
49                 // Utility:
50                 ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
51                 motion = ( direction === "up" || direction === "left" ),
52                 i = 0,
54                 queuelen = element.queue().length;
56         $.effects.createPlaceholder( element );
58         refValue = element.css( ref );
60         // Default distance for the BIGGEST bounce is the outer Distance / 3
61         if ( !distance ) {
62                 distance = element[ ref === "top" ? "outerHeight" : "outerWidth" ]() / 3;
63         }
65         if ( show ) {
66                 downAnim = { opacity: 1 };
67                 downAnim[ ref ] = refValue;
69                 // If we are showing, force opacity 0 and set the initial position
70                 // then do the "first" animation
71                 element
72                         .css( "opacity", 0 )
73                         .css( ref, motion ? -distance * 2 : distance * 2 )
74                         .animate( downAnim, speed, easing );
75         }
77         // Start at the smallest distance if we are hiding
78         if ( hide ) {
79                 distance = distance / Math.pow( 2, times - 1 );
80         }
82         downAnim = {};
83         downAnim[ ref ] = refValue;
85         // Bounces up/down/left/right then back to 0 -- times * 2 animations happen here
86         for ( ; i < times; i++ ) {
87                 upAnim = {};
88                 upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;
90                 element
91                         .animate( upAnim, speed, easing )
92                         .animate( downAnim, speed, easing );
94                 distance = hide ? distance * 2 : distance / 2;
95         }
97         // Last Bounce when Hiding
98         if ( hide ) {
99                 upAnim = { opacity: 0 };
100                 upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;
102                 element.animate( upAnim, speed, easing );
103         }
105         element.queue( done );
107         $.effects.unshift( element, queuelen, anims + 1 );
108 } );
110 } ) );