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()
},
.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();