effect-highlight.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*!
  2. * jQuery UI Effects Highlight 1.11.2
  3. * http://jqueryui.com
  4. *
  5. * Copyright 2014 jQuery Foundation and other contributors
  6. * Released under the MIT license.
  7. * http://jquery.org/license
  8. *
  9. * http://api.jqueryui.com/highlight-effect/
  10. */
  11. (function( factory ) {
  12. if ( typeof define === "function" && define.amd ) {
  13. // AMD. Register as an anonymous module.
  14. define([
  15. "jquery",
  16. "./effect"
  17. ], factory );
  18. } else {
  19. // Browser globals
  20. factory( jQuery );
  21. }
  22. }(function( $ ) {
  23. return $.effects.effect.highlight = function( o, done ) {
  24. var elem = $( this ),
  25. props = [ "backgroundImage", "backgroundColor", "opacity" ],
  26. mode = $.effects.setMode( elem, o.mode || "show" ),
  27. animation = {
  28. backgroundColor: elem.css( "backgroundColor" )
  29. };
  30. if (mode === "hide") {
  31. animation.opacity = 0;
  32. }
  33. $.effects.save( elem, props );
  34. elem
  35. .show()
  36. .css({
  37. backgroundImage: "none",
  38. backgroundColor: o.color || "#ffff99"
  39. })
  40. .animate( animation, {
  41. queue: false,
  42. duration: o.duration,
  43. easing: o.easing,
  44. complete: function() {
  45. if ( mode === "hide" ) {
  46. elem.hide();
  47. }
  48. $.effects.restore( elem, props );
  49. done();
  50. }
  51. });
  52. };
  53. }));