effect-highlight.js 1.2 KB

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