Position: Use offsets for all calculations in feedback API.

This commit is contained in:
Scott González 2012-04-20 11:02:50 -04:00
parent 22b7f9a819
commit 2cf9948cad
2 changed files with 5 additions and 5 deletions

View File

@ -14,7 +14,7 @@
$(function() { $(function() {
function using( position, feedback ) { function using( position, feedback ) {
$(this) $(this)
.offset( position ) .css( position )
.text( feedback.horizontal + " " + feedback.vertical + " " + feedback.important ) .text( feedback.horizontal + " " + feedback.vertical + " " + feedback.important )
.removeClass( "left right top bottom center middle vertical horizontal" ) .removeClass( "left right top bottom center middle vertical horizontal" )
.addClass( feedback.horizontal ) .addClass( feedback.horizontal )

View File

@ -235,9 +235,9 @@ $.fn.position = function( options ) {
if ( options.using ) { if ( options.using ) {
// adds feedback as second argument to using callback, if present // adds feedback as second argument to using callback, if present
using = function( props ) { using = function( props ) {
var left = targetOffset.left - props.left, var left = targetOffset.left - position.left,
right = left + targetWidth - elemWidth, right = left + targetWidth - elemWidth,
top = targetOffset.top - props.top, top = targetOffset.top - position.top,
bottom = top + targetHeight - elemHeight, bottom = top + targetHeight - elemHeight,
feedback = { feedback = {
target: { target: {
@ -249,8 +249,8 @@ $.fn.position = function( options ) {
}, },
element: { element: {
element: elem, element: elem,
left: props.left, left: position.left,
top: props.top, top: position.top,
width: elemWidth, width: elemWidth,
height: elemHeight height: elemHeight
}, },