aboutsummaryrefslogtreecommitdiffstats
path: root/src/offset.js
diff options
context:
space:
mode:
authorBrandon Aaron <brandon.aaron@gmail.com>2010-03-22 20:05:08 -0400
committerBrandon Aaron <brandon.aaron@gmail.com>2010-03-22 20:05:08 -0400
commit08cf82e88e7a1f88da34ca251335a685889f8765 (patch)
treeef284f0c747ca9eef1b069025cf1acf29b5255f7 /src/offset.js
parent1844f95c5b2f92a1b388ff43e20aa4f065a6e57c (diff)
downloadjquery-08cf82e88e7a1f88da34ca251335a685889f8765.tar.gz
jquery-08cf82e88e7a1f88da34ca251335a685889f8765.zip
Fix setting only one property at a time in .offset({})
Diffstat (limited to 'src/offset.js')
-rw-r--r--src/offset.js13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/offset.js b/src/offset.js
index 365b35aca..59591caea 100644
--- a/src/offset.js
+++ b/src/offset.js
@@ -157,16 +157,19 @@ jQuery.offset = {
var curElem = jQuery( elem ),
curOffset = curElem.offset(),
curTop = parseInt( jQuery.curCSS( elem, "top", true ), 10 ) || 0,
- curLeft = parseInt( jQuery.curCSS( elem, "left", true ), 10 ) || 0;
+ curLeft = parseInt( jQuery.curCSS( elem, "left", true ), 10 ) || 0,
+ props = {};
if ( jQuery.isFunction( options ) ) {
options = options.call( elem, i, curOffset );
}
- var props = {
- top: (options.top - curOffset.top) + curTop,
- left: (options.left - curOffset.left) + curLeft
- };
+ if (options.top != null) {
+ props.top = (options.top - curOffset.top) + curTop;
+ }
+ if (options.left != null) {
+ props.left = (options.left - curOffset.left) + curLeft;
+ }
if ( "using" in options ) {
options.using.call( elem, props );