Browse Source

Merge pull request #554 in VISUAL/fineui from ~FAY/fineui:master to master

* commit '073a71037e205bbb34909a016a111145e61318a9':
  update
es6
guy 6 years ago
parent
commit
d2e02f01fc
  1. 21
      src/core/jquery.js

21
src/core/jquery.js vendored

@ -9390,13 +9390,24 @@ jQuery.fn.offset = function( options ) {
// If we don't have gBCR, just use 0,0 rather than error // If we don't have gBCR, just use 0,0 rather than error
// BlackBerry 5, iOS 3 (original iPhone) // BlackBerry 5, iOS 3 (original iPhone)
if ( typeof elem.getBoundingClientRect !== core_strundefined ) { // if ( typeof elem.getBoundingClientRect !== core_strundefined ) {
box = elem.getBoundingClientRect(); // box = elem.getBoundingClientRect();
} // }
// 解决transform下的offset问题
var el = elem,
offsetLeft = 0,
offsetTop = 0;
do{
offsetLeft += el.offsetLeft;
offsetTop += el.offsetTop;
el = el.offsetParent;
} while( el );
win = getWindow( doc ); win = getWindow( doc );
return { return {
top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ), top: offsetTop + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ),
left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 ) left: offsetLeft + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 )
}; };
}; };

Loading…
Cancel
Save