From a33b087b3b569c289fd4194615708167fb546aca Mon Sep 17 00:00:00 2001 From: fay Date: Tue, 21 Aug 2018 15:56:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=81=A2=E5=A4=8Dscale?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/jquery.js | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/core/jquery.js b/src/core/jquery.js index fe501ea19..20f2b4b19 100644 --- a/src/core/jquery.js +++ b/src/core/jquery.js @@ -9390,30 +9390,30 @@ jQuery.fn.offset = function( options ) { // If we don't have gBCR, just use 0,0 rather than error // BlackBerry 5, iOS 3 (original iPhone) - // if ( typeof elem.getBoundingClientRect !== core_strundefined ) { - // box = elem.getBoundingClientRect(); - // } - // 解决transform下的offset问题 - var el = elem, - offsetLeft = 0, - offsetTop = 0; - - do{ - offsetLeft += el.offsetLeft; - offsetTop += el.offsetTop; - el = el.offsetParent; - } while( el ); - - var elm = elem; - do{ - offsetLeft -= elm.scrollLeft || 0; - offsetTop -= elm.scrollTop || 0; - elm = elm.parentNode; - } while( elm ); + if ( typeof elem.getBoundingClientRect !== core_strundefined ) { + box = elem.getBoundingClientRect(); + } + // 解决transform下的offset问题(先恢复) + // var el = elem, + // offsetLeft = 0, + // offsetTop = 0; + + // do{ + // offsetLeft += el.offsetLeft; + // offsetTop += el.offsetTop; + // el = el.offsetParent; + // } while( el ); + + // var elm = elem; + // do{ + // offsetLeft -= elm.scrollLeft || 0; + // offsetTop -= elm.scrollTop || 0; + // elm = elm.parentNode; + // } while( elm ); win = getWindow( doc ); return { - top: offsetTop + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ), - left: offsetLeft + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 ) + top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ), + left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 ) }; };