Position: Check to also make sure to only flip if more of the element is inside "within"

This commit is contained in:
kborchers 2011-09-16 11:52:22 -05:00
parent 8274f081e0
commit 7f808b2047

View File

@ -376,7 +376,7 @@ $.ui.position = {
newOverBottom; newOverBottom;
if ( overTop < 0 ) { if ( overTop < 0 ) {
newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - outerHeight - withinOffset; newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - outerHeight - withinOffset;
if ( newOverBottom < 0 || newOverBottom < Math.abs( overTop ) ) { if ( ( position.top + myOffset + atOffset + offset) > overTop && ( newOverBottom < 0 || newOverBottom < Math.abs( overTop ) ) ) {
data.elem data.elem
.addClass( "ui-flipped-bottom" ); .addClass( "ui-flipped-bottom" );
@ -385,7 +385,7 @@ $.ui.position = {
} }
else if ( overBottom > 0 ) { else if ( overBottom > 0 ) {
newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - withinOffset; newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - withinOffset;
if ( newOverTop > 0 || Math.abs( newOverTop ) < overBottom ) { if ( ( position.top + myOffset + atOffset + offset) > overBottom && ( newOverTop > 0 || Math.abs( newOverTop ) < overBottom ) ) {
data.elem data.elem
.addClass( "ui-flipped-top" ); .addClass( "ui-flipped-top" );