From: Jörn Zaefferer Date: Fri, 13 Apr 2012 14:05:29 +0000 (+0200) Subject: Position: Expose target and element dimensions to allow further customization, like... X-Git-Tag: 1.9.0m8~87^2~15 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a5fc9eb7db292629271e6414db9e98c3dc60224d;p=jquery-ui.git Position: Expose target and element dimensions to allow further customization, like calculating the angle between the two elements --- diff --git a/tests/visual/position/position_feedback.html b/tests/visual/position/position_feedback.html index 5b50ff32c..f23d8a299 100644 --- a/tests/visual/position/position_feedback.html +++ b/tests/visual/position/position_feedback.html @@ -13,13 +13,13 @@ + + + + + + + + + +
all around me
+ +
+ + + diff --git a/ui/jquery.ui.position.js b/ui/jquery.ui.position.js index 31da2237b..17d43b2a4 100644 --- a/ui/jquery.ui.position.js +++ b/ui/jquery.ui.position.js @@ -241,9 +241,22 @@ $.fn.position = function( options ) { top = targetOffset.top - props.top, bottom = (targetOffset.top + targetHeight) - (props.top + elemHeight), feedback = { + target: { + element: target, + left: targetOffset.left, + top: targetOffset.top, + width: targetWidth, + height: targetHeight + }, + element: { + element: elem, + left: props.left, + top: props.top, + width: elemWidth, + height: elemHeight + }, horizontal: right < 0 ? "left" : left > 0 ? "right" : "center", - vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle", - target: target + vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle" }, max = Math.max, abs = Math.abs;