effect-highlight.js (1191B)
1 /*! 2 * jQuery UI Effects Highlight 1.12.1 3 * http://jqueryui.com 4 * 5 * Copyright jQuery Foundation and other contributors 6 * Released under the MIT license. 7 * http://jquery.org/license 8 */ 9 10 //>>label: Highlight Effect 11 //>>group: Effects 12 //>>description: Highlights the background of an element in a defined color for a custom duration. 13 //>>docs: http://api.jqueryui.com/highlight-effect/ 14 //>>demos: http://jqueryui.com/effect/ 15 16 ( function( factory ) { 17 if ( typeof define === "function" && define.amd ) { 18 19 // AMD. Register as an anonymous module. 20 define( [ 21 "jquery", 22 "./effect" 23 ], factory ); 24 } else { 25 26 // Browser globals 27 factory( jQuery ); 28 } 29 }( function( $ ) { 30 31 return $.effects.define( "highlight", "show", function( options, done ) { 32 var element = $( this ), 33 animation = { 34 backgroundColor: element.css( "backgroundColor" ) 35 }; 36 37 if ( options.mode === "hide" ) { 38 animation.opacity = 0; 39 } 40 41 $.effects.saveStyle( element ); 42 43 element 44 .css( { 45 backgroundImage: "none", 46 backgroundColor: options.color || "#ffff99" 47 } ) 48 .animate( animation, { 49 queue: false, 50 duration: options.duration, 51 easing: options.easing, 52 complete: done 53 } ); 54 } ); 55 56 } ) );