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 using( position, feedback ) {
$(this)
.offset( position )
.css( position )
.text( feedback.horizontal + " " + feedback.vertical + " " + feedback.important )
.removeClass( "left right top bottom center middle vertical horizontal" )
.addClass( feedback.horizontal )

View File

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