18
|
1 |
/*! |
|
2 |
* jQuery UI Effects Scale 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 |
*/ |
|
9 |
|
|
10 |
//>>label: Scale Effect |
|
11 |
//>>group: Effects |
|
12 |
//>>description: Grows or shrinks an element and its content. |
|
13 |
//>>docs: http://api.jqueryui.com/scale-effect/ |
|
14 |
//>>demos: http://jqueryui.com/effect/ |
|
15 |
|
|
16 |
( function( factory ) { |
|
17 |
if ( typeof define === "function" && define.amd ) { |
|
18 |
|
|
19 |
// AMD. Register as an anonymous module. |
|
20 |
define( [ |
|
21 |
"jquery", |
|
22 |
"./effect", |
|
23 |
"./effect-size" |
|
24 |
], factory ); |
|
25 |
} else { |
|
26 |
|
|
27 |
// Browser globals |
|
28 |
factory( jQuery ); |
|
29 |
} |
|
30 |
}( function( $ ) { |
|
31 |
|
|
32 |
return $.effects.define( "scale", function( options, done ) { |
|
33 |
|
|
34 |
// Create element |
|
35 |
var el = $( this ), |
|
36 |
mode = options.mode, |
|
37 |
percent = parseInt( options.percent, 10 ) || |
|
38 |
( parseInt( options.percent, 10 ) === 0 ? 0 : ( mode !== "effect" ? 0 : 100 ) ), |
|
39 |
|
|
40 |
newOptions = $.extend( true, { |
|
41 |
from: $.effects.scaledDimensions( el ), |
|
42 |
to: $.effects.scaledDimensions( el, percent, options.direction || "both" ), |
|
43 |
origin: options.origin || [ "middle", "center" ] |
|
44 |
}, options ); |
|
45 |
|
|
46 |
// Fade option to support puff |
|
47 |
if ( options.fade ) { |
|
48 |
newOptions.from.opacity = 1; |
|
49 |
newOptions.to.opacity = 0; |
|
50 |
} |
|
51 |
|
|
52 |
$.effects.effect.size.call( this, newOptions, done ); |
|
53 |
} ); |
|
54 |
|
|
55 |
} ) ); |