From: Scott González Date: Mon, 15 Jun 2009 02:21:44 +0000 (+0000) Subject: Refactored puff effect. X-Git-Tag: 1.8a1~90 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f505d5a230472d5bfd2c188d40ac1726f593906b;p=jquery-ui.git Refactored puff effect. --- 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) {