diff options
author | Sylvester Keil <sylvester@keil.or.at> | 2011-01-15 13:56:20 +0100 |
---|---|---|
committer | Sylvester Keil <sylvester@keil.or.at> | 2011-01-15 13:56:20 +0100 |
commit | 75655e5758bc786989f26a98b09aabbfb88f66fd (patch) | |
tree | b3b281f9cea6d756e9e16995908415b0132047ee /src/offset.js | |
parent | d9cb69873c0be7cb2f65d24deeb6a01fada0661b (diff) | |
download | jquery-75655e5758bc786989f26a98b09aabbfb88f66fd.tar.gz jquery-75655e5758bc786989f26a98b09aabbfb88f66fd.zip |
Use parseFloat instead of parseInt to read CSS values.
This fixes #7730 and #7885.
Diffstat (limited to 'src/offset.js')
-rw-r--r-- | src/offset.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/offset.js b/src/offset.js index 2040c9d83..94b67c77a 100644 --- a/src/offset.js +++ b/src/offset.js @@ -187,11 +187,13 @@ jQuery.offset = { // need to be able to calculate position if either top or left is auto and position is absolute if ( calculatePosition ) { curPosition = curElem.position(); + curTop = curPosition.top; + curLeft = curPosition.left; + } else { + curTop = parseFloat( curCSSTop ) || 0; + curLeft = parseFloat( curCSSLeft ) || 0; } - curTop = calculatePosition ? curPosition.top : parseInt( curCSSTop, 10 ) || 0; - curLeft = calculatePosition ? curPosition.left : parseInt( curCSSLeft, 10 ) || 0; - if ( jQuery.isFunction( options ) ) { options = options.call( elem, i, curOffset ); } |