effects.highlight.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * jQuery UI Effects Highlight 1.7.2
  3. *
  4. * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
  5. * Dual licensed under the MIT (MIT-LICENSE.txt)
  6. * and GPL (GPL-LICENSE.txt) licenses.
  7. *
  8. * http://docs.jquery.com/UI/Effects/Highlight
  9. *
  10. * Depends:
  11. * effects.core.js
  12. */
  13. (function($) {
  14. $.effects.highlight = function(o) {
  15. return this.queue(function() {
  16. // Create element
  17. var el = $(this), props = ['backgroundImage','backgroundColor','opacity'];
  18. // Set options
  19. var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode
  20. var color = o.options.color || "#ffff99"; // Default highlight color
  21. var oldColor = el.css("backgroundColor");
  22. // Adjust
  23. $.effects.save(el, props); el.show(); // Save & Show
  24. el.css({backgroundImage: 'none', backgroundColor: color}); // Shift
  25. // Animation
  26. var animation = {backgroundColor: oldColor };
  27. if (mode == "hide") animation['opacity'] = 0;
  28. // Animate
  29. el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
  30. if(mode == "hide") el.hide();
  31. $.effects.restore(el, props);
  32. if (mode == "show" && $.browser.msie) this.style.removeAttribute('filter');
  33. if(o.callback) o.callback.apply(this, arguments);
  34. el.dequeue();
  35. }});
  36. });
  37. };
  38. })(jQuery);