Debian Codegraph @

ui/effects/effect-scale.js

raw symbols SCIP
1 /*!
2 * jQuery UI Effects Scale 1.14.2
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: Scale Effect
11 //>>group: Effects
12 //>>description: Grows or shrinks an element and its content.
13 //>>docs: https://api.jqueryui.com/scale-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 "./effect-size"
27 ], factory );
28 } else {
29
30 // Browser globals
31 factory( jQuery );
32 }
33 } )( function( $ ) {
34 "use strict";
35
36 return $.effects.define( "scale", function( options, done ) {
37
38 // Create element
39 var el = $( this ),
40 mode = options.mode,
41 percent = parseInt( options.percent, 10 ) ||
42 ( parseInt( options.percent, 10 ) === 0 ? 0 : ( mode !== "effect" ? 0 : 100 ) ),
43
44 newOptions = $.extend( true, {
45 from: $.effects.scaledDimensions( el ),
46 to: $.effects.scaledDimensions( el, percent, options.direction || "both" ),
47 origin: options.origin || [ "middle", "center" ]
48 }, options );
49
50 // Fade option to support puff
51 if ( options.fade ) {
52 newOptions.from.opacity = 1;
53 newOptions.to.opacity = 0;
54 }
55
56 $.effects.effect.size.call( this, newOptions, done );
57 } );
58
59 } );