diff options
author | Scott González <scott.gonzalez@gmail.com> | 2009-06-15 02:21:44 +0000 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2009-06-15 02:21:44 +0000 |
commit | f505d5a230472d5bfd2c188d40ac1726f593906b (patch) | |
tree | 7a6956ca5520e912fd30d1ac1a406c3ce3a6f284 | |
parent | 25398447f172d86114fc61f237da511a1b76fa29 (diff) | |
download | jquery-ui-f505d5a230472d5bfd2c188d40ac1726f593906b.tar.gz jquery-ui-f505d5a230472d5bfd2c188d40ac1726f593906b.zip |
Refactored puff effect.
-rw-r--r-- | ui/effects.scale.js | 45 |
1 files changed, 20 insertions, 25 deletions
diff --git a/ui/effects.scale.js b/ui/effects.scale.js index 79912791a..3a2023537 100644 --- a/ui/effects.scale.js +++ b/ui/effects.scale.js @@ -13,33 +13,28 @@ (function($) { $.effects.puff = function(o) { - return this.queue(function() { - - // Create element - var el = $(this); - - // Set options - var options = $.extend(true, {}, o.options); - var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode - var percent = parseInt(o.options.percent,10) || 150; // Set default puff percent - options.fade = true; // It's not a puff if it doesn't fade! :) - var original = {height: el.height(), width: el.width()}; // Save original - - // Adjust - var factor = percent / 100; - el.from = (mode == 'hide') ? original : {height: original.height * factor, width: original.width * factor}; - - // Animation - options.from = el.from; - options.percent = (mode == 'hide') ? percent : 100; - options.mode = mode; - - // Animate - el.effect('scale', options, o.duration, o.callback); - el.dequeue(); + var elem = $(this), + mode = $.effects.setMode(elem, o.options.mode || 'hide'), + percent = parseInt(o.options.percent, 10) || 150, + factor = percent / 100, + original = { height: elem.height(), width: elem.width() }; + + $.extend(o.options, { + fade: true, + mode: mode, + percent: mode == 'hide' ? percent : 100, + from: mode == 'hide' + ? original + : { + height: original.height * factor, + width: original.width * factor + } + }); + + elem.effect('scale', o.options, o.duration, o.callback); + elem.dequeue(); }); - }; $.effects.scale = function(o) { |