mirror of
https://github.com/jquery/jquery-ui.git
synced 2026-04-20 03:02:41 -04:00
Effects.transfer: check the target is fixed or not, and consider scrolling. Fixed #5547 - Transfer effect to fixed positioned element.
This commit is contained in:
14
ui/jquery.effects.transfer.js
vendored
14
ui/jquery.effects.transfer.js
vendored
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user