From: kborchers Date: Fri, 16 Sep 2011 16:52:22 +0000 (-0500) Subject: Position: Check to also make sure to only flip if more of the element is inside ... X-Git-Tag: 1.9m7~223 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=7f808b2047725cd8fde51a948cb4e5f5946c82e1;p=jquery-ui.git Position: Check to also make sure to only flip if more of the element is inside "within" --- diff --git a/ui/jquery.ui.position.js b/ui/jquery.ui.position.js index 24a033fc2..74530b948 100644 --- a/ui/jquery.ui.position.js +++ b/ui/jquery.ui.position.js @@ -376,7 +376,7 @@ $.ui.position = { newOverBottom; if ( overTop < 0 ) { 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 .addClass( "ui-flipped-bottom" ); @@ -385,7 +385,7 @@ $.ui.position = { } else if ( overBottom > 0 ) { 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 .addClass( "ui-flipped-top" );