Skip to content

Commit

Permalink
Effects.transfer: check the target is fixed or not, and consider scro…
Browse files Browse the repository at this point in the history
…lling. Fixed #5547 - Transfer effect to fixed positioned element.
  • Loading branch information
tomykaira authored and gnarf committed Jun 10, 2011
1 parent 154c5e5 commit 3e0d3c9
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions ui/jquery.effects.transfer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
},
Expand All @@ -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();
Expand Down

0 comments on commit 3e0d3c9

Please sign in to comment.