effects.explode: correcting my misspelled variable name :/

This commit is contained in:
gnarf 2011-03-12 14:41:56 -06:00
parent 39dcad6e49
commit 7bb0e40f7a

View File

@ -28,21 +28,19 @@ $.effects.explode = function( o ) {
// width and height of a piece // width and height of a piece
width = Math.ceil( el.outerWidth() / cells ), width = Math.ceil( el.outerWidth() / cells ),
height = Math.ceil( el.outerHeight() / rows ), height = Math.ceil( el.outerHeight() / rows ),
peices = [], pieces = [],
i, j, pos;
// loop
i, j, left, top, mx, my;
// clone the element for each row and cell. // clone the element for each row and cell.
for( i = 0; i < rows ; i++ ) { // ===> for( i = 0; i < rows ; i++ ) { // ===>
for( j = 0; j < cells ; j++ ) { // ||| top = offset.top + i * height;
pos = { my = i - ( rows - 1 ) / 2 ;
// wrapper base position in body
left: offset.left + j * width,
top: offset.top + i * height,
// x position in matrix with 0,0 at the center for( j = 0; j < cells ; j++ ) { // |||
rx: j - cells / 2, left = offset.left + j * width;
ry: i - rows / 2 mx = j - ( cells - 1 ) / 2 ;
};
// Create a clone of the now hidden main element that will be absolute positioned // 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 // within a wrapper div off the -left and -top equal to size of our pieces
@ -66,12 +64,12 @@ $.effects.explode = function( o ) {
overflow: 'hidden', overflow: 'hidden',
width: width, width: width,
height: height, height: height,
left: pos.left + ( show ? pos.rx * width : 0 ), left: left + ( show ? mx * width : 0 ),
top: pos.top + ( show ? pos.ry * height : 0 ), top: top + ( show ? my * height : 0 ),
opacity: show ? 0 : 1 opacity: show ? 0 : 1
}).animate({ }).animate({
left: pos.left + ( show ? 0 : pos.rx * width ), left: left + ( show ? 0 : mx * width ),
top: pos.top + ( show ? 0 : pos.ry * height ), top: top + ( show ? 0 : my * height ),
opacity: show ? 1 : 0 opacity: show ? 1 : 0
}, o.duration || 500, o.easing, childComplete ); }, o.duration || 500, o.easing, childComplete );
} }
@ -79,8 +77,8 @@ $.effects.explode = function( o ) {
// children animate complete: // children animate complete:
function childComplete() { function childComplete() {
peices.push( this ); pieces.push( this );
if ( peices.length == rows * cells ) { if ( pieces.length == rows * cells ) {
animComplete(); animComplete();
} }
} }
@ -89,7 +87,7 @@ $.effects.explode = function( o ) {
el.css({ el.css({
visibility: 'visible' visibility: 'visible'
}); });
$( peices ).remove(); $( pieces ).remove();
if ( !show ) { if ( !show ) {
el.hide(); el.hide();
} }