mirror of https://github.com/ElemeFE/element
Fix #2867
parent
658a91ee23
commit
d0be75a467
|
@ -517,9 +517,17 @@
|
|||
var scrollParent = getScrollParent(this._popper);
|
||||
var offsetParentRect = getOffsetRect(offsetParent);
|
||||
|
||||
// Thanks the fucking native API, `document.body.scrollTop` & `document.documentElement.scrollTop`
|
||||
var getScrollTopValue = function (element) {
|
||||
return element == document.body ? Math.max(document.documentElement.scrollTop, document.body.scrollTop) : element.scrollTop;
|
||||
}
|
||||
var getScrollLeftValue = function (element) {
|
||||
return element == document.body ? Math.max(document.documentElement.scrollLeft, document.body.scrollLeft) : element.scrollLeft;
|
||||
}
|
||||
|
||||
// if the popper is fixed we don't have to substract scrolling from the boundaries
|
||||
var scrollTop = data.offsets.popper.position === 'fixed' ? 0 : scrollParent.scrollTop;
|
||||
var scrollLeft = data.offsets.popper.position === 'fixed' ? 0 : scrollParent.scrollLeft;
|
||||
var scrollTop = data.offsets.popper.position === 'fixed' ? 0 : getScrollTopValue(scrollParent);
|
||||
var scrollLeft = data.offsets.popper.position === 'fixed' ? 0 : getScrollLeftValue(scrollParent);
|
||||
|
||||
boundaries = {
|
||||
top: 0 - (offsetParentRect.top - scrollTop),
|
||||
|
|
Loading…
Reference in New Issue