Skip to content
Permalink
Browse files

Effects: Fix style issues in individual effects

Skipping ui/effect.js since embedded jquery-color has many issues.

Closes gh-1510
  • Loading branch information
jzaefferer committed Mar 18, 2015
1 parent c16a5e5 commit 868e8c70e391b5ba886edc93fdec28086a6a3fca
@@ -83,7 +83,7 @@ var
"ui/datepicker.js",
"ui/draggable.js",
"ui/droppable.js",
"ui/effect*.js",
"ui/effect.js",
"ui/mouse.js",
"ui/resizable.js",
"ui/selectable.js",
@@ -13,11 +13,11 @@
//>>docs: http://api.jqueryui.com/blind-effect/
//>>demos: http://jqueryui.com/effect/

(function( factory ) {
( function( factory ) {
if ( typeof define === "function" && define.amd ) {

// AMD. Register as an anonymous module.
define([
define( [
"jquery",
"./effect"
], factory );
@@ -26,7 +26,7 @@
// Browser globals
factory( jQuery );
}
}(function( $ ) {
}( function( $ ) {

return $.effects.define( "blind", "hide", function( options, done ) {
var map = {
@@ -63,7 +63,7 @@ return $.effects.define( "blind", "hide", function( options, done ) {
duration: options.duration,
easing: options.easing,
complete: done
});
});
} );
} );

}));
} ) );
@@ -13,11 +13,11 @@
//>>docs: http://api.jqueryui.com/bounce-effect/
//>>demos: http://jqueryui.com/effect/

(function( factory ) {
( function( factory ) {
if ( typeof define === "function" && define.amd ) {

// AMD. Register as an anonymous module.
define([
define( [
"jquery",
"./effect"
], factory );
@@ -26,7 +26,7 @@
// Browser globals
factory( jQuery );
}
}(function( $ ) {
}( function( $ ) {

return $.effects.define( "bounce", function( options, done ) {
var upAnim, downAnim, refValue,
@@ -103,6 +103,6 @@ return $.effects.define( "bounce", function( options, done ) {
element.queue( done );

$.effects.unshift( element, queuelen, anims + 1 );
});
} );

}));
} ) );
@@ -13,11 +13,11 @@
//>>docs: http://api.jqueryui.com/clip-effect/
//>>demos: http://jqueryui.com/effect/

(function( factory ) {
( function( factory ) {
if ( typeof define === "function" && define.amd ) {

// AMD. Register as an anonymous module.
define([
define( [
"jquery",
"./effect"
], factory );
@@ -26,7 +26,7 @@
// Browser globals
factory( jQuery );
}
}(function( $ ) {
}( function( $ ) {

return $.effects.define( "clip", "hide", function( options, done ) {
var start,
@@ -57,8 +57,8 @@ return $.effects.define( "clip", "hide", function( options, done ) {
duration: options.duration,
easing: options.easing,
complete: done
});
} );

});
} );

}));
} ) );
@@ -13,11 +13,11 @@
//>>docs: http://api.jqueryui.com/drop-effect/
//>>demos: http://jqueryui.com/effect/

(function( factory ) {
( function( factory ) {
if ( typeof define === "function" && define.amd ) {

// AMD. Register as an anonymous module.
define([
define( [
"jquery",
"./effect"
], factory );
@@ -26,7 +26,7 @@
// Browser globals
factory( jQuery );
}
}(function( $ ) {
}( function( $ ) {

return $.effects.define( "drop", "hide", function( options, done ) {

@@ -61,7 +61,7 @@ return $.effects.define( "drop", "hide", function( options, done ) {
duration: options.duration,
easing: options.easing,
complete: done
});
});
} );
} );

}));
} ) );
@@ -13,11 +13,11 @@
//>>docs: http://api.jqueryui.com/explode-effect/
//>>demos: http://jqueryui.com/effect/

(function( factory ) {
( function( factory ) {
if ( typeof define === "function" && define.amd ) {

// AMD. Register as an anonymous module.
define([
define( [
"jquery",
"./effect"
], factory );
@@ -26,7 +26,7 @@
// Browser globals
factory( jQuery );
}
}(function( $ ) {
}( function( $ ) {

return $.effects.define( "explode", "hide", function( options, done ) {

@@ -54,54 +54,55 @@ return $.effects.define( "explode", "hide", function( options, done ) {
}

// clone the element for each row and cell.
for ( i = 0; i < rows ; i++ ) { // ===>
for ( i = 0; i < rows; i++ ) { // ===>
top = offset.top + i * height;
my = i - ( rows - 1 ) / 2 ;
my = i - ( rows - 1 ) / 2;

for ( j = 0; j < cells ; j++ ) { // |||
for ( j = 0; j < cells; j++ ) { // |||
left = offset.left + j * width;
mx = j - ( cells - 1 ) / 2 ;
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({
.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
// 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 );
.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({
element.css( {
visibility: "visible"
});
} );
$( pieces ).remove();
done();
}
});
} );

}));
} ) );
@@ -13,11 +13,11 @@
//>>docs: http://api.jqueryui.com/fade-effect/
//>>demos: http://jqueryui.com/effect/

(function( factory ) {
( function( factory ) {
if ( typeof define === "function" && define.amd ) {

// AMD. Register as an anonymous module.
define([
define( [
"jquery",
"./effect"
], factory );
@@ -26,21 +26,21 @@
// Browser globals
factory( jQuery );
}
}(function( $ ) {
}( function( $ ) {

return $.effects.define( "fade", "toggle", function( options, done ) {
var show = options.mode === "show";

$( this )
.css( "opacity", show ? 0 : 1 )
.animate({
.animate( {
opacity: show ? 1 : 0
}, {
queue: false,
duration: options.duration,
easing: options.easing,
complete: done
});
});
} );
} );

}));
} ) );
@@ -13,11 +13,11 @@
//>>docs: http://api.jqueryui.com/fold-effect/
//>>demos: http://jqueryui.com/effect/

(function( factory ) {
( function( factory ) {
if ( typeof define === "function" && define.amd ) {

// AMD. Register as an anonymous module.
define([
define( [
"jquery",
"./effect"
], factory );
@@ -26,7 +26,7 @@
// Browser globals
factory( jQuery );
}
}(function( $ ) {
}( function( $ ) {

return $.effects.define( "fold", "hide", function( options, done ) {

@@ -69,20 +69,20 @@ return $.effects.define( "fold", "hide", function( options, done ) {

// Animate
element
.queue(function( next ) {
.queue( function( next ) {
if ( placeholder ) {
placeholder
.animate( $.effects.clipToBox( animation1 ), duration, options.easing )
.animate( $.effects.clipToBox( animation2 ), duration, options.easing );
}

next();
})
} )
.animate( animation1, duration, options.easing )
.animate( animation2, duration, options.easing )
.queue( done );

$.effects.unshift( element, queuelen, 4 );
});
} );

}));
} ) );
@@ -13,11 +13,11 @@
//>>docs: http://api.jqueryui.com/highlight-effect/
//>>demos: http://jqueryui.com/effect/

(function( factory ) {
( function( factory ) {
if ( typeof define === "function" && define.amd ) {

// AMD. Register as an anonymous module.
define([
define( [
"jquery",
"./effect"
], factory );
@@ -26,7 +26,7 @@
// Browser globals
factory( jQuery );
}
}(function( $ ) {
}( function( $ ) {

return $.effects.define( "highlight", "show", function( options, done ) {
var element = $( this ),
@@ -41,16 +41,16 @@ return $.effects.define( "highlight", "show", function( options, done ) {
$.effects.saveStyle( element );

element
.css({
.css( {
backgroundImage: "none",
backgroundColor: options.color || "#ffff99"
})
} )
.animate( animation, {
queue: false,
duration: options.duration,
easing: options.easing,
complete: done
});
});
} );
} );

}));
} ) );

0 comments on commit 868e8c7

Please sign in to comment.
You can’t perform that action at this time.