Effects: Fix style issues in individual effects

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

Closes gh-1510
This commit is contained in:
Jörn Zaefferer 2015-03-18 15:39:12 +01:00
parent c16a5e58f9
commit 868e8c70e3
16 changed files with 118 additions and 117 deletions

View File

@ -83,7 +83,7 @@ var
"ui/datepicker.js", "ui/datepicker.js",
"ui/draggable.js", "ui/draggable.js",
"ui/droppable.js", "ui/droppable.js",
"ui/effect*.js", "ui/effect.js",
"ui/mouse.js", "ui/mouse.js",
"ui/resizable.js", "ui/resizable.js",
"ui/selectable.js", "ui/selectable.js",

View File

@ -13,11 +13,11 @@
//>>docs: http://api.jqueryui.com/blind-effect/ //>>docs: http://api.jqueryui.com/blind-effect/
//>>demos: http://jqueryui.com/effect/ //>>demos: http://jqueryui.com/effect/
(function( factory ) { ( function( factory ) {
if ( typeof define === "function" && define.amd ) { if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module. // AMD. Register as an anonymous module.
define([ define( [
"jquery", "jquery",
"./effect" "./effect"
], factory ); ], factory );
@ -26,7 +26,7 @@
// Browser globals // Browser globals
factory( jQuery ); factory( jQuery );
} }
}(function( $ ) { }( function( $ ) {
return $.effects.define( "blind", "hide", function( options, done ) { return $.effects.define( "blind", "hide", function( options, done ) {
var map = { var map = {
@ -63,7 +63,7 @@ return $.effects.define( "blind", "hide", function( options, done ) {
duration: options.duration, duration: options.duration,
easing: options.easing, easing: options.easing,
complete: done complete: done
}); } );
}); } );
})); } ) );

View File

@ -13,11 +13,11 @@
//>>docs: http://api.jqueryui.com/bounce-effect/ //>>docs: http://api.jqueryui.com/bounce-effect/
//>>demos: http://jqueryui.com/effect/ //>>demos: http://jqueryui.com/effect/
(function( factory ) { ( function( factory ) {
if ( typeof define === "function" && define.amd ) { if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module. // AMD. Register as an anonymous module.
define([ define( [
"jquery", "jquery",
"./effect" "./effect"
], factory ); ], factory );
@ -26,7 +26,7 @@
// Browser globals // Browser globals
factory( jQuery ); factory( jQuery );
} }
}(function( $ ) { }( function( $ ) {
return $.effects.define( "bounce", function( options, done ) { return $.effects.define( "bounce", function( options, done ) {
var upAnim, downAnim, refValue, var upAnim, downAnim, refValue,
@ -103,6 +103,6 @@ return $.effects.define( "bounce", function( options, done ) {
element.queue( done ); element.queue( done );
$.effects.unshift( element, queuelen, anims + 1 ); $.effects.unshift( element, queuelen, anims + 1 );
}); } );
})); } ) );

View File

@ -13,11 +13,11 @@
//>>docs: http://api.jqueryui.com/clip-effect/ //>>docs: http://api.jqueryui.com/clip-effect/
//>>demos: http://jqueryui.com/effect/ //>>demos: http://jqueryui.com/effect/
(function( factory ) { ( function( factory ) {
if ( typeof define === "function" && define.amd ) { if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module. // AMD. Register as an anonymous module.
define([ define( [
"jquery", "jquery",
"./effect" "./effect"
], factory ); ], factory );
@ -26,7 +26,7 @@
// Browser globals // Browser globals
factory( jQuery ); factory( jQuery );
} }
}(function( $ ) { }( function( $ ) {
return $.effects.define( "clip", "hide", function( options, done ) { return $.effects.define( "clip", "hide", function( options, done ) {
var start, var start,
@ -57,8 +57,8 @@ return $.effects.define( "clip", "hide", function( options, done ) {
duration: options.duration, duration: options.duration,
easing: options.easing, easing: options.easing,
complete: done complete: done
}); } );
}); } );
})); } ) );

View File

@ -13,11 +13,11 @@
//>>docs: http://api.jqueryui.com/drop-effect/ //>>docs: http://api.jqueryui.com/drop-effect/
//>>demos: http://jqueryui.com/effect/ //>>demos: http://jqueryui.com/effect/
(function( factory ) { ( function( factory ) {
if ( typeof define === "function" && define.amd ) { if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module. // AMD. Register as an anonymous module.
define([ define( [
"jquery", "jquery",
"./effect" "./effect"
], factory ); ], factory );
@ -26,7 +26,7 @@
// Browser globals // Browser globals
factory( jQuery ); factory( jQuery );
} }
}(function( $ ) { }( function( $ ) {
return $.effects.define( "drop", "hide", function( options, done ) { return $.effects.define( "drop", "hide", function( options, done ) {
@ -61,7 +61,7 @@ return $.effects.define( "drop", "hide", function( options, done ) {
duration: options.duration, duration: options.duration,
easing: options.easing, easing: options.easing,
complete: done complete: done
}); } );
}); } );
})); } ) );

View File

@ -13,11 +13,11 @@
//>>docs: http://api.jqueryui.com/explode-effect/ //>>docs: http://api.jqueryui.com/explode-effect/
//>>demos: http://jqueryui.com/effect/ //>>demos: http://jqueryui.com/effect/
(function( factory ) { ( function( factory ) {
if ( typeof define === "function" && define.amd ) { if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module. // AMD. Register as an anonymous module.
define([ define( [
"jquery", "jquery",
"./effect" "./effect"
], factory ); ], factory );
@ -26,7 +26,7 @@
// Browser globals // Browser globals
factory( jQuery ); factory( jQuery );
} }
}(function( $ ) { }( function( $ ) {
return $.effects.define( "explode", "hide", function( options, done ) { return $.effects.define( "explode", "hide", function( options, done ) {
@ -54,13 +54,13 @@ return $.effects.define( "explode", "hide", function( options, done ) {
} }
// 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++ ) { // ===>
top = offset.top + i * height; 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; 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 // 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
@ -68,18 +68,18 @@ return $.effects.define( "explode", "hide", function( options, done ) {
.clone() .clone()
.appendTo( "body" ) .appendTo( "body" )
.wrap( "<div></div>" ) .wrap( "<div></div>" )
.css({ .css( {
position: "absolute", position: "absolute",
visibility: "visible", visibility: "visible",
left: -j * width, left: -j * width,
top: -i * height top: -i * height
}) } )
// select the wrapper - make it overflow: hidden and absolute positioned based on // 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 // where the original was located +left and +top equal to the size of pieces
.parent() .parent()
.addClass( "ui-effects-explode" ) .addClass( "ui-effects-explode" )
.css({ .css( {
position: "absolute", position: "absolute",
overflow: "hidden", overflow: "hidden",
width: width, width: width,
@ -87,7 +87,8 @@ return $.effects.define( "explode", "hide", function( options, done ) {
left: left + ( show ? mx * width : 0 ), left: left + ( show ? mx * width : 0 ),
top: top + ( show ? my * height : 0 ), top: top + ( show ? my * height : 0 ),
opacity: show ? 0 : 1 opacity: show ? 0 : 1
}).animate({ } )
.animate( {
left: left + ( show ? 0 : mx * width ), left: left + ( show ? 0 : mx * width ),
top: top + ( show ? 0 : my * height ), top: top + ( show ? 0 : my * height ),
opacity: show ? 1 : 0 opacity: show ? 1 : 0
@ -96,12 +97,12 @@ return $.effects.define( "explode", "hide", function( options, done ) {
} }
function animComplete() { function animComplete() {
element.css({ element.css( {
visibility: "visible" visibility: "visible"
}); } );
$( pieces ).remove(); $( pieces ).remove();
done(); done();
} }
}); } );
})); } ) );

View File

@ -13,11 +13,11 @@
//>>docs: http://api.jqueryui.com/fade-effect/ //>>docs: http://api.jqueryui.com/fade-effect/
//>>demos: http://jqueryui.com/effect/ //>>demos: http://jqueryui.com/effect/
(function( factory ) { ( function( factory ) {
if ( typeof define === "function" && define.amd ) { if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module. // AMD. Register as an anonymous module.
define([ define( [
"jquery", "jquery",
"./effect" "./effect"
], factory ); ], factory );
@ -26,21 +26,21 @@
// Browser globals // Browser globals
factory( jQuery ); factory( jQuery );
} }
}(function( $ ) { }( function( $ ) {
return $.effects.define( "fade", "toggle", function( options, done ) { return $.effects.define( "fade", "toggle", function( options, done ) {
var show = options.mode === "show"; var show = options.mode === "show";
$( this ) $( this )
.css( "opacity", show ? 0 : 1 ) .css( "opacity", show ? 0 : 1 )
.animate({ .animate( {
opacity: show ? 1 : 0 opacity: show ? 1 : 0
}, { }, {
queue: false, queue: false,
duration: options.duration, duration: options.duration,
easing: options.easing, easing: options.easing,
complete: done complete: done
}); } );
}); } );
})); } ) );

View File

@ -13,11 +13,11 @@
//>>docs: http://api.jqueryui.com/fold-effect/ //>>docs: http://api.jqueryui.com/fold-effect/
//>>demos: http://jqueryui.com/effect/ //>>demos: http://jqueryui.com/effect/
(function( factory ) { ( function( factory ) {
if ( typeof define === "function" && define.amd ) { if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module. // AMD. Register as an anonymous module.
define([ define( [
"jquery", "jquery",
"./effect" "./effect"
], factory ); ], factory );
@ -26,7 +26,7 @@
// Browser globals // Browser globals
factory( jQuery ); factory( jQuery );
} }
}(function( $ ) { }( function( $ ) {
return $.effects.define( "fold", "hide", function( options, done ) { return $.effects.define( "fold", "hide", function( options, done ) {
@ -69,7 +69,7 @@ return $.effects.define( "fold", "hide", function( options, done ) {
// Animate // Animate
element element
.queue(function( next ) { .queue( function( next ) {
if ( placeholder ) { if ( placeholder ) {
placeholder placeholder
.animate( $.effects.clipToBox( animation1 ), duration, options.easing ) .animate( $.effects.clipToBox( animation1 ), duration, options.easing )
@ -77,12 +77,12 @@ return $.effects.define( "fold", "hide", function( options, done ) {
} }
next(); next();
}) } )
.animate( animation1, duration, options.easing ) .animate( animation1, duration, options.easing )
.animate( animation2, duration, options.easing ) .animate( animation2, duration, options.easing )
.queue( done ); .queue( done );
$.effects.unshift( element, queuelen, 4 ); $.effects.unshift( element, queuelen, 4 );
}); } );
})); } ) );

View File

@ -13,11 +13,11 @@
//>>docs: http://api.jqueryui.com/highlight-effect/ //>>docs: http://api.jqueryui.com/highlight-effect/
//>>demos: http://jqueryui.com/effect/ //>>demos: http://jqueryui.com/effect/
(function( factory ) { ( function( factory ) {
if ( typeof define === "function" && define.amd ) { if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module. // AMD. Register as an anonymous module.
define([ define( [
"jquery", "jquery",
"./effect" "./effect"
], factory ); ], factory );
@ -26,7 +26,7 @@
// Browser globals // Browser globals
factory( jQuery ); factory( jQuery );
} }
}(function( $ ) { }( function( $ ) {
return $.effects.define( "highlight", "show", function( options, done ) { return $.effects.define( "highlight", "show", function( options, done ) {
var element = $( this ), var element = $( this ),
@ -41,16 +41,16 @@ return $.effects.define( "highlight", "show", function( options, done ) {
$.effects.saveStyle( element ); $.effects.saveStyle( element );
element element
.css({ .css( {
backgroundImage: "none", backgroundImage: "none",
backgroundColor: options.color || "#ffff99" backgroundColor: options.color || "#ffff99"
}) } )
.animate( animation, { .animate( animation, {
queue: false, queue: false,
duration: options.duration, duration: options.duration,
easing: options.easing, easing: options.easing,
complete: done complete: done
}); } );
}); } );
})); } ) );

View File

@ -13,11 +13,11 @@
//>>docs: http://api.jqueryui.com/puff-effect/ //>>docs: http://api.jqueryui.com/puff-effect/
//>>demos: http://jqueryui.com/effect/ //>>demos: http://jqueryui.com/effect/
(function( factory ) { ( function( factory ) {
if ( typeof define === "function" && define.amd ) { if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module. // AMD. Register as an anonymous module.
define([ define( [
"jquery", "jquery",
"./effect", "./effect",
"./effect-scale" "./effect-scale"
@ -27,15 +27,15 @@
// Browser globals // Browser globals
factory( jQuery ); factory( jQuery );
} }
}(function( $ ) { }( function( $ ) {
return $.effects.define( "puff", "hide", function( options, done ) { return $.effects.define( "puff", "hide", function( options, done ) {
var newOptions = $.extend( true, {}, options, { var newOptions = $.extend( true, {}, options, {
fade: true, fade: true,
percent: parseInt( options.percent, 10 ) || 150 percent: parseInt( options.percent, 10 ) || 150
}); } );
$.effects.effect.scale.call( this, newOptions, done ); $.effects.effect.scale.call( this, newOptions, done );
}); } );
})); } ) );

View File

@ -13,11 +13,11 @@
//>>docs: http://api.jqueryui.com/pulsate-effect/ //>>docs: http://api.jqueryui.com/pulsate-effect/
//>>demos: http://jqueryui.com/effect/ //>>demos: http://jqueryui.com/effect/
(function( factory ) { ( function( factory ) {
if ( typeof define === "function" && define.amd ) { if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module. // AMD. Register as an anonymous module.
define([ define( [
"jquery", "jquery",
"./effect" "./effect"
], factory ); ], factory );
@ -26,7 +26,7 @@
// Browser globals // Browser globals
factory( jQuery ); factory( jQuery );
} }
}(function( $ ) { }( function( $ ) {
return $.effects.define( "pulsate", "show", function( options, done ) { return $.effects.define( "pulsate", "show", function( options, done ) {
var element = $( this ), var element = $( this ),
@ -58,6 +58,6 @@ return $.effects.define( "pulsate", "show", function( options, done ) {
element.queue( done ); element.queue( done );
$.effects.unshift( element, queuelen, anims + 1 ); $.effects.unshift( element, queuelen, anims + 1 );
}); } );
})); } ) );

View File

@ -13,11 +13,11 @@
//>>docs: http://api.jqueryui.com/scale-effect/ //>>docs: http://api.jqueryui.com/scale-effect/
//>>demos: http://jqueryui.com/effect/ //>>demos: http://jqueryui.com/effect/
(function( factory ) { ( function( factory ) {
if ( typeof define === "function" && define.amd ) { if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module. // AMD. Register as an anonymous module.
define([ define( [
"jquery", "jquery",
"./effect", "./effect",
"./effect-size" "./effect-size"
@ -27,7 +27,7 @@
// Browser globals // Browser globals
factory( jQuery ); factory( jQuery );
} }
}(function( $ ) { }( function( $ ) {
return $.effects.define( "scale", function( options, done ) { return $.effects.define( "scale", function( options, done ) {
@ -50,6 +50,6 @@ return $.effects.define( "scale", function( options, done ) {
} }
$.effects.effect.size.call( this, newOptions, done ); $.effects.effect.size.call( this, newOptions, done );
}); } );
})); } ) );

View File

@ -13,11 +13,11 @@
//>>docs: http://api.jqueryui.com/shake-effect/ //>>docs: http://api.jqueryui.com/shake-effect/
//>>demos: http://jqueryui.com/effect/ //>>demos: http://jqueryui.com/effect/
(function( factory ) { ( function( factory ) {
if ( typeof define === "function" && define.amd ) { if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module. // AMD. Register as an anonymous module.
define([ define( [
"jquery", "jquery",
"./effect" "./effect"
], factory ); ], factory );
@ -26,7 +26,7 @@
// Browser globals // Browser globals
factory( jQuery ); factory( jQuery );
} }
}(function( $ ) { }( function( $ ) {
return $.effects.define( "shake", function( options, done ) { return $.effects.define( "shake", function( options, done ) {
@ -66,6 +66,6 @@ return $.effects.define( "shake", function( options, done ) {
.queue( done ); .queue( done );
$.effects.unshift( element, queuelen, anims + 1 ); $.effects.unshift( element, queuelen, anims + 1 );
}); } );
})); } ) );

View File

@ -13,11 +13,11 @@
//>>docs: http://api.jqueryui.com/size-effect/ //>>docs: http://api.jqueryui.com/size-effect/
//>>demos: http://jqueryui.com/effect/ //>>demos: http://jqueryui.com/effect/
(function( factory ) { ( function( factory ) {
if ( typeof define === "function" && define.amd ) { if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module. // AMD. Register as an anonymous module.
define([ define( [
"jquery", "jquery",
"./effect" "./effect"
], factory ); ], factory );
@ -26,7 +26,7 @@
// Browser globals // Browser globals
factory( jQuery ); factory( jQuery );
} }
}(function( $ ) { }( function( $ ) {
return $.effects.define( "size", function( options, done ) { return $.effects.define( "size", function( options, done ) {
@ -109,8 +109,8 @@ return $.effects.define( "size", function( options, done ) {
// Animate the children if desired // Animate the children if desired
if ( scale === "content" || scale === "both" ) { if ( scale === "content" || scale === "both" ) {
vProps = vProps.concat([ "marginTop", "marginBottom" ]).concat( cProps ); vProps = vProps.concat( [ "marginTop", "marginBottom" ] ).concat( cProps );
hProps = hProps.concat([ "marginLeft", "marginRight" ]); hProps = hProps.concat( [ "marginLeft", "marginRight" ] );
// Only animate children with width attributes specified // Only animate children with width attributes specified
// TODO: is this right? should we include anything with css width specified as well // TODO: is this right? should we include anything with css width specified as well
@ -154,8 +154,8 @@ return $.effects.define( "size", function( options, done ) {
if ( restore ) { if ( restore ) {
$.effects.restoreStyle( child ); $.effects.restoreStyle( child );
} }
}); } );
}); } );
} }
// Animate // Animate
@ -183,8 +183,8 @@ return $.effects.define( "size", function( options, done ) {
done(); done();
} }
}); } );
}); } );
})); } ) );

View File

@ -13,11 +13,11 @@
//>>docs: http://api.jqueryui.com/slide-effect/ //>>docs: http://api.jqueryui.com/slide-effect/
//>>demos: http://jqueryui.com/effect/ //>>demos: http://jqueryui.com/effect/
(function( factory ) { ( function( factory ) {
if ( typeof define === "function" && define.amd ) { if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module. // AMD. Register as an anonymous module.
define([ define( [
"jquery", "jquery",
"./effect" "./effect"
], factory ); ], factory );
@ -26,7 +26,7 @@
// Browser globals // Browser globals
factory( jQuery ); factory( jQuery );
} }
}(function( $ ) { }( function( $ ) {
return $.effects.define( "slide", "show", function( options, done ) { return $.effects.define( "slide", "show", function( options, done ) {
var startClip, startRef, var startClip, startRef,
@ -68,7 +68,7 @@ return $.effects.define( "slide", "show", function( options, done ) {
duration: options.duration, duration: options.duration,
easing: options.easing, easing: options.easing,
complete: done complete: done
}); } );
}); } );
})); } ) );

View File

@ -13,11 +13,11 @@
//>>docs: http://api.jqueryui.com/transfer-effect/ //>>docs: http://api.jqueryui.com/transfer-effect/
//>>demos: http://jqueryui.com/effect/ //>>demos: http://jqueryui.com/effect/
(function( factory ) { ( function( factory ) {
if ( typeof define === "function" && define.amd ) { if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module. // AMD. Register as an anonymous module.
define([ define( [
"jquery", "jquery",
"./effect" "./effect"
], factory ); ], factory );
@ -26,12 +26,12 @@
// Browser globals // Browser globals
factory( jQuery ); factory( jQuery );
} }
}(function( $ ) { }( function( $ ) {
if ( $.uiBackCompat !== false ) { if ( $.uiBackCompat !== false ) {
return $.effects.define( "transfer", function( options, done ) { return $.effects.define( "transfer", function( options, done ) {
$( this ).transfer( options, done ); $( this ).transfer( options, done );
}); } );
} }
})); } ) );