mirror of
https://gitee.com/ElemeFE/element.git
synced 2024-11-30 11:17:38 +08:00
fix ie9/10 bounding top bug
This commit is contained in:
parent
4b10284478
commit
cd16a0b20d
@ -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
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user