|
13 | 13 | //>>docs: http://api.jqueryui.com/explode-effect/ |
14 | 14 | //>>demos: http://jqueryui.com/effect/ |
15 | 15 |
|
16 | | -(function( factory ) { |
| 16 | +( function( factory ) { |
17 | 17 | if ( typeof define === "function" && define.amd ) { |
18 | 18 |
|
19 | 19 | // AMD. Register as an anonymous module. |
20 | | - define([ |
| 20 | + define( [ |
21 | 21 | "jquery", |
22 | 22 | "./effect" |
23 | 23 | ], factory ); |
|
26 | 26 | // Browser globals |
27 | 27 | factory( jQuery ); |
28 | 28 | } |
29 | | -}(function( $ ) { |
| 29 | +}( function( $ ) { |
30 | 30 |
|
31 | 31 | return $.effects.define( "explode", "hide", function( options, done ) { |
32 | 32 |
|
@@ -54,54 +54,55 @@ return $.effects.define( "explode", "hide", function( options, done ) { |
54 | 54 | } |
55 | 55 |
|
56 | 56 | // clone the element for each row and cell. |
57 | | - for ( i = 0; i < rows ; i++ ) { // ===> |
| 57 | + for ( i = 0; i < rows; i++ ) { // ===> |
58 | 58 | top = offset.top + i * height; |
59 | | - my = i - ( rows - 1 ) / 2 ; |
| 59 | + my = i - ( rows - 1 ) / 2; |
60 | 60 |
|
61 | | - for ( j = 0; j < cells ; j++ ) { // ||| |
| 61 | + for ( j = 0; j < cells; j++ ) { // ||| |
62 | 62 | left = offset.left + j * width; |
63 | | - mx = j - ( cells - 1 ) / 2 ; |
| 63 | + mx = j - ( cells - 1 ) / 2; |
64 | 64 |
|
65 | 65 | // Create a clone of the now hidden main element that will be absolute positioned |
66 | 66 | // within a wrapper div off the -left and -top equal to size of our pieces |
67 | 67 | element |
68 | 68 | .clone() |
69 | 69 | .appendTo( "body" ) |
70 | 70 | .wrap( "<div></div>" ) |
71 | | - .css({ |
| 71 | + .css( { |
72 | 72 | position: "absolute", |
73 | 73 | visibility: "visible", |
74 | 74 | left: -j * width, |
75 | 75 | top: -i * height |
76 | | - }) |
| 76 | + } ) |
77 | 77 |
|
78 | | - // select the wrapper - make it overflow: hidden and absolute positioned based on |
79 | | - // where the original was located +left and +top equal to the size of pieces |
| 78 | + // select the wrapper - make it overflow: hidden and absolute positioned based on |
| 79 | + // where the original was located +left and +top equal to the size of pieces |
80 | 80 | .parent() |
81 | | - .addClass( "ui-effects-explode" ) |
82 | | - .css({ |
83 | | - position: "absolute", |
84 | | - overflow: "hidden", |
85 | | - width: width, |
86 | | - height: height, |
87 | | - left: left + ( show ? mx * width : 0 ), |
88 | | - top: top + ( show ? my * height : 0 ), |
89 | | - opacity: show ? 0 : 1 |
90 | | - }).animate({ |
91 | | - left: left + ( show ? 0 : mx * width ), |
92 | | - top: top + ( show ? 0 : my * height ), |
93 | | - opacity: show ? 1 : 0 |
94 | | - }, options.duration || 500, options.easing, childComplete ); |
| 81 | + .addClass( "ui-effects-explode" ) |
| 82 | + .css( { |
| 83 | + position: "absolute", |
| 84 | + overflow: "hidden", |
| 85 | + width: width, |
| 86 | + height: height, |
| 87 | + left: left + ( show ? mx * width : 0 ), |
| 88 | + top: top + ( show ? my * height : 0 ), |
| 89 | + opacity: show ? 0 : 1 |
| 90 | + } ) |
| 91 | + .animate( { |
| 92 | + left: left + ( show ? 0 : mx * width ), |
| 93 | + top: top + ( show ? 0 : my * height ), |
| 94 | + opacity: show ? 1 : 0 |
| 95 | + }, options.duration || 500, options.easing, childComplete ); |
95 | 96 | } |
96 | 97 | } |
97 | 98 |
|
98 | 99 | function animComplete() { |
99 | | - element.css({ |
| 100 | + element.css( { |
100 | 101 | visibility: "visible" |
101 | | - }); |
| 102 | + } ); |
102 | 103 | $( pieces ).remove(); |
103 | 104 | done(); |
104 | 105 | } |
105 | | -}); |
| 106 | +} ); |
106 | 107 |
|
107 | | -})); |
| 108 | +} ) ); |
0 commit comments