From: Scott González Date: Tue, 17 Feb 2009 01:20:50 +0000 (+0000) Subject: Cleaned up transfer effect. Despite the huge diff, I didn't change any logic and... X-Git-Tag: 1.7~85 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=6754eaa33802e1c22269b827c91acf19c670f9ca;p=jquery-ui.git Cleaned up transfer effect. Despite the huge diff, I didn't change any logic and barely changed any actual code. --- diff --git a/ui/effects.transfer.js b/ui/effects.transfer.js index 8a627a96b..49105ac17 100644 --- a/ui/effects.transfer.js +++ b/ui/effects.transfer.js @@ -13,47 +13,33 @@ (function($) { $.effects.transfer = function(o) { - return this.queue(function() { - - // Create element - var el = $(this); - - // Set options - var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode - var target = $(o.options.to); // Find Target - var position = el.offset(); - var transfer = $('
').appendTo(document.body); - if(o.options.className) transfer.addClass(o.options.className); - - // Set target css - transfer.addClass(o.options.className); - transfer.css({ - top: position.top, - left: position.left, - height: el.innerHeight(), - width: el.innerWidth(), - position: 'absolute' - }); - - // Animation - position = target.offset(); - animation = { - top: position.top, - left: position.left, - height: target.innerHeight(), - width: target.innerWidth() - }; - - // Animate - transfer.animate(animation, o.duration, o.options.easing, function() { - transfer.remove(); // Remove div - if(o.callback) o.callback.apply(el[0], arguments); // Callback - el.dequeue(); - }); - + var elem = $(this), + target = $(o.options.to), + endPosition = target.offset(), + animation = { + top: endPosition.top, + left: endPosition.left, + height: target.innerHeight(), + width: target.innerWidth() + }, + startPosition = elem.offset(), + transfer = $('
') + .appendTo(document.body) + .addClass(o.options.className) + .css({ + top: startPosition.top, + left: startPosition.left, + height: elem.innerHeight(), + width: elem.innerWidth(), + position: 'absolute' + }) + .animate(animation, o.duration, o.options.easing, function() { + transfer.remove(); + (o.callback && o.callback.apply(elem[0], arguments)); + elem.dequeue(); + }); }); - }; })(jQuery);