aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorkborchers <kris.borchers@gmail.com>2012-04-04 22:11:57 -0500
committerkborchers <kris.borchers@gmail.com>2012-04-04 22:12:11 -0500
commitcd90e57f2293db1a8fa82e6832abf8d72d024d14 (patch)
tree400ef01ca70e515f55b2678caa5eb4c66ca45b46 /ui
parent343375b623258fe5ee276b29eda452b91a7f07a2 (diff)
parente7701e2efac7e718f0aea5e57f4c260c8b08017c (diff)
downloadjquery-ui-cd90e57f2293db1a8fa82e6832abf8d72d024d14.tar.gz
jquery-ui-cd90e57f2293db1a8fa82e6832abf8d72d024d14.zip
Merge branch 'positionWithin'
Diffstat (limited to 'ui')
-rw-r--r--ui/jquery.ui.position.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/ui/jquery.ui.position.js b/ui/jquery.ui.position.js
index d751e9374..95b8b460d 100644
--- a/ui/jquery.ui.position.js
+++ b/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" );