aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2009-07-21 04:21:50 +0000
committerScott González <scott.gonzalez@gmail.com>2009-07-21 04:21:50 +0000
commit269a4412683dbb05d02de02fb7dd98e23d373ebb (patch)
treedfb03e3bdf5fa2aa1095d3aaeabe6c2ab5d3a23a /ui
parent553c6cf7c15f0257e87a5695b8d564cd02a07fb3 (diff)
downloadjquery-ui-269a4412683dbb05d02de02fb7dd98e23d373ebb.tar.gz
jquery-ui-269a4412683dbb05d02de02fb7dd98e23d373ebb.zip
Highlight effect: refactor.
Diffstat (limited to 'ui')
-rw-r--r--ui/effects.highlight.js58
1 files changed, 30 insertions, 28 deletions
diff --git a/ui/effects.highlight.js b/ui/effects.highlight.js
index 9919ddab5..ebc958243 100644
--- a/ui/effects.highlight.js
+++ b/ui/effects.highlight.js
@@ -13,36 +13,38 @@
(function($) {
$.effects.highlight = function(o) {
-
return this.queue(function() {
-
- // Create element
- var el = $(this), props = ['backgroundImage','backgroundColor','opacity'];
-
- // Set options
- var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode
- var color = o.options.color || "#ffff99"; // Default highlight color
- var oldColor = el.css("backgroundColor");
-
- // Adjust
- $.effects.save(el, props); el.show(); // Save & Show
- el.css({backgroundImage: 'none', backgroundColor: color}); // Shift
-
- // Animation
- var animation = {backgroundColor: oldColor };
- if (mode == "hide") animation['opacity'] = 0;
-
- // Animate
- el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
- if(mode == "hide") el.hide();
- $.effects.restore(el, props);
- if (mode == "show" && !$.support.opacity) this.style.removeAttribute('filter');
- if(o.callback) o.callback.apply(this, arguments);
- el.dequeue();
- }});
-
+ var elem = $(this),
+ props = ['backgroundImage', 'backgroundColor', 'opacity'],
+ mode = $.effects.setMode(elem, o.options.mode || 'show'),
+ animation = {
+ backgroundColor: elem.css('backgroundColor')
+ };
+
+ if (mode == 'hide') {
+ animation.opacity = 0;
+ }
+
+ $.effects.save(elem, props);
+ elem
+ .show()
+ .css({
+ backgroundImage: 'none',
+ backgroundColor: o.options.color || '#ffff99'
+ })
+ .animate(animation, {
+ queue: false,
+ duration: o.duration,
+ easing: o.options.easing,
+ complete: function() {
+ (mode == 'hide' && elem.hide());
+ $.effects.restore(elem, props);
+ (mode == 'show' && !$.support.opacity && this.style.removeAttribute('filter'));
+ (o.callback && o.callback.apply(this, arguments));
+ elem.dequeue();
+ }
+ });
});
-
};
})(jQuery);