From cd16a0b20d84b21716df41bdf148ad0336b31bd9 Mon Sep 17 00:00:00 2001 From: baiyaaaaa Date: Sat, 5 Nov 2016 12:12:40 +0800 Subject: [PATCH] fix ie9/10 bounding top bug --- src/utils/popper.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/utils/popper.js b/src/utils/popper.js index 20299d407..b3b904936 100644 --- a/src/utils/popper.js +++ b/src/utils/popper.js @@ -1148,13 +1148,22 @@ */ function getBoundingClientRect(element) { var rect = element.getBoundingClientRect(); + + // whether the IE version is lower than 11 + var isIE = navigator.userAgent.indexOf("MSIE") != -1; + + // fix ie document bouding top always 0 bug + var rectTop = isIE && element.tagName === 'HTML' + ? -element.scrollTop + : rect.top; + return { left: rect.left, - top: rect.top, + top: rectTop, right: rect.right, bottom: rect.bottom, width: rect.right - rect.left, - height: rect.bottom - rect.top + height: rect.bottom - rectTop }; }