mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
727a9151d2
Closes gh-1403
(cherry picked from commit c89cb74893
)
61 lines
1.2 KiB
JavaScript
61 lines
1.2 KiB
JavaScript
/*!
|
|
* jQuery UI Effects Highlight @VERSION
|
|
* http://jqueryui.com
|
|
*
|
|
* Copyright jQuery Foundation and other contributors
|
|
* Released under the MIT license.
|
|
* http://jquery.org/license
|
|
*
|
|
* http://api.jqueryui.com/highlight-effect/
|
|
*/
|
|
(function( factory ) {
|
|
if ( typeof define === "function" && define.amd ) {
|
|
|
|
// AMD. Register as an anonymous module.
|
|
define([
|
|
"jquery",
|
|
"./effect"
|
|
], factory );
|
|
} else {
|
|
|
|
// Browser globals
|
|
factory( jQuery );
|
|
}
|
|
}(function( $ ) {
|
|
|
|
return $.effects.effect.highlight = function( o, done ) {
|
|
var elem = $( this ),
|
|
props = [ "backgroundImage", "backgroundColor", "opacity" ],
|
|
mode = $.effects.setMode( elem, o.mode || "show" ),
|
|
animation = {
|
|
backgroundColor: elem.css( "backgroundColor" )
|
|
};
|
|
|
|
if (mode === "hide") {
|
|
animation.opacity = 0;
|
|
}
|
|
|
|
$.effects.save( elem, props );
|
|
|
|
elem
|
|
.show()
|
|
.css({
|
|
backgroundImage: "none",
|
|
backgroundColor: o.color || "#ffff99"
|
|
})
|
|
.animate( animation, {
|
|
queue: false,
|
|
duration: o.duration,
|
|
easing: o.easing,
|
|
complete: function() {
|
|
if ( mode === "hide" ) {
|
|
elem.hide();
|
|
}
|
|
$.effects.restore( elem, props );
|
|
done();
|
|
}
|
|
});
|
|
};
|
|
|
|
}));
|