Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Position: Fixed issue with offsets using the within option which caused flips to not happen when the containing element had been scrolled. #626

Merged
merged 1 commit into from

2 participants

@kborchers
Owner

No description provided.

@kborchers kborchers Position: Fixed issue with offsets using the within option which caus…
…ed flips to not happen when the containing element had been scrolled.
e7701e2
@kborchers
Owner

@jzaefferer This should fix that issue you found. A quick review would be appreciated.

@jzaefferer
Owner

Looks good

@kborchers kborchers merged commit e7701e2 into jquery:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 4, 2012
  1. @kborchers

    Position: Fixed issue with offsets using the within option which caus…

    kborchers authored
    …ed flips to not happen when the containing element had been scrolled.
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 6 deletions.
  1. +8 −6 ui/jquery.ui.position.js
View
14 ui/jquery.ui.position.js
@@ -317,9 +317,10 @@ $.ui.position = {
isWindow = $.isWindow( data.within[0] ),
withinOffset = ( isWindow ? 0 : within.offset().left ) + within.scrollLeft(),
outerWidth = isWindow ? within.width() : within.outerWidth(),
+ offsetLeft = isWindow ? 0 : within.offset().left,
collisionPosLeft = position.left - data.collisionPosition.marginLeft,
- overLeft = collisionPosLeft - withinOffset,
- overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset,
+ overLeft = collisionPosLeft - offsetLeft,
+ overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft,
left = data.my[ 0 ] === "left",
myOffset = data.my[ 0 ] === "left" ?
-data.elemWidth :
@@ -343,7 +344,7 @@ $.ui.position = {
}
}
else if ( overRight > 0 ) {
- newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + atOffset + offset - withinOffset;
+ newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + atOffset + offset - offsetLeft;
if ( newOverLeft > 0 || Math.abs( newOverLeft ) < overRight ) {
data.elem
.addClass( "ui-flipped-left" );
@@ -365,9 +366,10 @@ $.ui.position = {
isWindow = $.isWindow( data.within[0] ),
withinOffset = ( isWindow ? 0 : within.offset().top ) + within.scrollTop(),
outerHeight = isWindow ? within.height() : within.outerHeight(),
+ offsetTop = isWindow ? 0 : within.offset().top,
collisionPosTop = position.top - data.collisionPosition.marginTop,
- overTop = collisionPosTop - withinOffset,
- overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset,
+ overTop = collisionPosTop - offsetTop,
+ overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop,
top = data.my[ 1 ] === "top",
myOffset = top ?
-data.elemHeight :
@@ -390,7 +392,7 @@ $.ui.position = {
}
}
else if ( overBottom > 0 ) {
- newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - withinOffset;
+ newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - offsetTop;
if ( ( position.top + myOffset + atOffset + offset) > overBottom && ( newOverTop > 0 || Math.abs( newOverTop ) < overBottom ) ) {
data.elem
.addClass( "ui-flipped-top" );
Something went wrong with that request. Please try again.