aboutsummaryrefslogtreecommitdiffstats
path: root/ui/effect-explode.js
diff options
context:
space:
mode:
authorAlexander Schmitz <arschmitz@gmail.com>2015-07-14 22:01:41 -0400
committerAlexander Schmitz <arschmitz@gmail.com>2015-08-08 00:29:38 -0400
commit59ea81003da93d74414989a6c49498183e501289 (patch)
treed31adff0bfafbde19994e55c634a53bbcf599dc2 /ui/effect-explode.js
parent3b2db14b3beb1d5abbb2b9d102b1afa14733fef2 (diff)
downloadjquery-ui-59ea81003da93d74414989a6c49498183e501289.tar.gz
jquery-ui-59ea81003da93d74414989a6c49498183e501289.zip
Effects: Move individual effects into effects folder
Ref #13885
Diffstat (limited to 'ui/effect-explode.js')
-rw-r--r--ui/effect-explode.js109
1 files changed, 0 insertions, 109 deletions
diff --git a/ui/effect-explode.js b/ui/effect-explode.js
deleted file mode 100644
index 918ad2c3b..000000000
--- a/ui/effect-explode.js
+++ /dev/null
@@ -1,109 +0,0 @@
-/*!
- * jQuery UI Effects Explode @VERSION
- * http://jqueryui.com
- *
- * Copyright jQuery Foundation and other contributors
- * Released under the MIT license.
- * http://jquery.org/license
- */
-
-//>>label: Explode Effect
-//>>group: Effects
-//>>description: Explodes an element in all directions into n pieces. Implodes an element to its original wholeness.
-//>>docs: http://api.jqueryui.com/explode-effect/
-//>>demos: http://jqueryui.com/effect/
-
-( function( factory ) {
- if ( typeof define === "function" && define.amd ) {
-
- // AMD. Register as an anonymous module.
- define( [
- "jquery",
- "./version",
- "./effect"
- ], factory );
- } else {
-
- // Browser globals
- factory( jQuery );
- }
-}( function( $ ) {
-
-return $.effects.define( "explode", "hide", function( options, done ) {
-
- var i, j, left, top, mx, my,
- rows = options.pieces ? Math.round( Math.sqrt( options.pieces ) ) : 3,
- cells = rows,
- element = $( this ),
- mode = options.mode,
- show = mode === "show",
-
- // show and then visibility:hidden the element before calculating offset
- offset = element.show().css( "visibility", "hidden" ).offset(),
-
- // width and height of a piece
- width = Math.ceil( element.outerWidth() / cells ),
- height = Math.ceil( element.outerHeight() / rows ),
- pieces = [];
-
- // children animate complete:
- function childComplete() {
- pieces.push( this );
- if ( pieces.length === rows * cells ) {
- animComplete();
- }
- }
-
- // clone the element for each row and cell.
- for ( i = 0; i < rows; i++ ) { // ===>
- top = offset.top + i * height;
- my = i - ( rows - 1 ) / 2;
-
- for ( j = 0; j < cells; j++ ) { // |||
- left = offset.left + j * width;
- mx = j - ( cells - 1 ) / 2;
-
- // Create a clone of the now hidden main element that will be absolute positioned
- // within a wrapper div off the -left and -top equal to size of our pieces
- element
- .clone()
- .appendTo( "body" )
- .wrap( "<div></div>" )
- .css( {
- position: "absolute",
- visibility: "visible",
- left: -j * width,
- top: -i * height
- } )
-
- // select the wrapper - make it overflow: hidden and absolute positioned based on
- // where the original was located +left and +top equal to the size of pieces
- .parent()
- .addClass( "ui-effects-explode" )
- .css( {
- position: "absolute",
- overflow: "hidden",
- width: width,
- height: height,
- left: left + ( show ? mx * width : 0 ),
- top: top + ( show ? my * height : 0 ),
- opacity: show ? 0 : 1
- } )
- .animate( {
- left: left + ( show ? 0 : mx * width ),
- top: top + ( show ? 0 : my * height ),
- opacity: show ? 1 : 0
- }, options.duration || 500, options.easing, childComplete );
- }
- }
-
- function animComplete() {
- element.css( {
- visibility: "visible"
- } );
- $( pieces ).remove();
- done();
- }
-} );
-
-} ) );