diff options
-rw-r--r-- | tests/visual/position/position.html | 8 | ||||
-rw-r--r-- | tests/visual/position/position_notification.html | 10 | ||||
-rw-r--r-- | ui/jquery.ui.position.js | 11 |
3 files changed, 15 insertions, 14 deletions
diff --git a/tests/visual/position/position.html b/tests/visual/position/position.html index 89d991231..532774526 100644 --- a/tests/visual/position/position.html +++ b/tests/visual/position/position.html @@ -28,12 +28,12 @@ my: "left top+20", at: "left bottom", of: this, - using: function( position ) { - input.val(position.horizontal + " " + position.vertical) + using: function( position, feedback ) { + input.val(feedback.horizontal + " " + feedback.vertical) $(this).offset( position ) .removeClass("left right top bottom") - .addClass(position.horizontal) - .addClass(position.vertical); + .addClass(feedback.horizontal) + .addClass(feedback.vertical); } }); }); diff --git a/tests/visual/position/position_notification.html b/tests/visual/position/position_notification.html index d87c506ca..810663c5e 100644 --- a/tests/visual/position/position_notification.html +++ b/tests/visual/position/position_notification.html @@ -37,14 +37,14 @@ my: "center", at: direction, of: target, - using: function( position ) { + using: function( position, feedback ) { $(this).offset( position ); - $(this).text(position.horizontal + " " + position.vertical + " " + position.important) + $(this).text(feedback.horizontal + " " + feedback.vertical + " " + feedback.important) $(this) .removeClass("left right top bottom") - .addClass(position.horizontal) - .addClass(position.vertical) - .addClass(position.important); + .addClass(feedback.horizontal) + .addClass(feedback.vertical) + .addClass(feedback.important); } }) }); diff --git a/ui/jquery.ui.position.js b/ui/jquery.ui.position.js index 003e43c3f..cc0676370 100644 --- a/ui/jquery.ui.position.js +++ b/ui/jquery.ui.position.js @@ -226,14 +226,15 @@ $.fn.position = function( options ) { right = (targetOffset.left + targetWidth) - (props.left + elemWidth), top = targetOffset.top - props.top, bottom = (targetOffset.top + targetHeight) - (props.top + elemHeight); - props.horizontal = right < 0 ? "left" : left > 0 ? "right" : "center"; - props.vertical = bottom < 0 ? "top" : top > 0 ? "bottom" : "middle"; + var feedback = {}; + feedback.horizontal = right < 0 ? "left" : left > 0 ? "right" : "center"; + feedback.vertical = bottom < 0 ? "top" : top > 0 ? "bottom" : "middle"; if (Math.max(Math.abs(left), Math.abs(right)) > Math.max(Math.abs(top), Math.abs(bottom))) { - props.important = "horizontal"; + feedback.important = "horizontal"; } else { - props.important = "vertical"; + feedback.important = "vertical"; } - using.apply( this, arguments ); + using.call( this, props, feedback ); }; } elem.offset( $.extend( position, { using: options.using } ) ); |