]> source.dussan.org Git - jquery-ui.git/commitdiff
Position: Restrict the center/middle priority to target < element cases
authorJörn Zaefferer <joern.zaefferer@gmail.com>
Thu, 12 Apr 2012 14:14:16 +0000 (16:14 +0200)
committerJörn Zaefferer <joern.zaefferer@gmail.com>
Thu, 12 Apr 2012 14:14:16 +0000 (16:14 +0200)
ui/jquery.ui.position.js

index bf741871b6edc95b9beb04f308749ca44687d8e6..9226909d5acbe76a4cb91a68cf31cb445b3e5adb 100644 (file)
@@ -232,10 +232,10 @@ $.fn.position = function( options ) {
                                                horizontal: right < 0 ? "left" : left > 0 ? "right" : "center",
                                                vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle"
                                        };
-                               if ( Math.abs( left + right ) < targetWidth ) {
+                               if ( targetWidth < elemWidth && Math.abs( left + right ) < targetWidth ) {
                                        feedback.horizontal = "center";
                                }
-                               if ( Math.abs( top + bottom ) < targetHeight ) {
+                               if ( targetHeight < elemHeight && Math.abs( top + bottom ) < targetHeight ) {
                                        feedback.vertical = "middle";
                                }
                                if ( Math.max( Math.abs( left ), Math.abs( right ) ) > Math.max( Math.abs( top ), Math.abs( bottom ) ) ) {