diff options
author | tomykaira <tomykaira@gmail.com> | 2011-06-10 15:52:27 -0500 |
---|---|---|
committer | gnarf <gnarf@gnarf.net> | 2011-06-10 15:52:27 -0500 |
commit | 3e0d3c9225913db2f5aa8cd48ff29efa95f1feab (patch) | |
tree | 6390a03fd6d49cca118e786e05b00323edcebbb6 | |
parent | 154c5e5fd1d6de9dac369914eb98b5b966cdfae1 (diff) | |
download | jquery-ui-3e0d3c9225913db2f5aa8cd48ff29efa95f1feab.tar.gz jquery-ui-3e0d3c9225913db2f5aa8cd48ff29efa95f1feab.zip |
Effects.transfer: check the target is fixed or not, and consider scrolling. Fixed #5547 - Transfer effect to fixed positioned element.
-rw-r--r-- | ui/jquery.effects.transfer.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/ui/jquery.effects.transfer.js b/ui/jquery.effects.transfer.js index 17d23c5fa..f0f9d9fd4 100644 --- a/ui/jquery.effects.transfer.js +++ b/ui/jquery.effects.transfer.js @@ -17,10 +17,14 @@ $.effects.effect.transfer = function( o ) { return this.queue( function() { var elem = $( this ), target = $( o.to ), + targetFixed = target.css( "position" ) === "fixed", + body = $("body"), + fixTop = targetFixed ? body.scrollTop() : 0, + fixLeft = targetFixed ? body.scrollLeft() : 0, endPosition = target.offset(), animation = { - top: endPosition.top, - left: endPosition.left, + top: endPosition.top - fixTop , + left: endPosition.left - fixLeft , height: target.innerHeight(), width: target.innerWidth() }, @@ -29,11 +33,11 @@ $.effects.effect.transfer = function( o ) { .appendTo( document.body ) .addClass( o.className ) .css({ - top: startPosition.top, - left: startPosition.left, + top: startPosition.top - fixTop , + left: startPosition.left - fixLeft , height: elem.innerHeight(), width: elem.innerWidth(), - position: 'absolute' + position: targetFixed ? "fixed" : "absolute" }) .animate( animation, o.duration, o.easing, function() { transfer.remove(); |