From: Janusz Dobrowolski Date: Wed, 18 Mar 2009 22:09:59 +0000 (+0000) Subject: Fix for IE in element_pos() X-Git-Tag: v2.4.2~19^2~1464 X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;h=db9975842d1a1be7977355a3cc0875f6d68023dd;p=fa-stable.git Fix for IE in element_pos() --- diff --git a/js/utils.js b/js/utils.js index 25b6e19a..f4a4f65c 100644 --- a/js/utils.js +++ b/js/utils.js @@ -275,9 +275,10 @@ function element_pos(e) { var offsetParent = e.offsetParent; var parentNode = e.parentNode; - while (offsetParent !== null) { + while (offsetParent !== null && offsetParent.style.display != 'none') { res.x += offsetParent.offsetLeft; res.y += offsetParent.offsetTop; + // the second case is for IE6/7 in some doctypes if (offsetParent != document.body && offsetParent != document.documentElement) { res.x -= offsetParent.scrollLeft; res.y -= offsetParent.scrollTop; @@ -296,6 +297,6 @@ function element_pos(e) { } } // parentNode has style.display set to none - if (parentNode!=document.documentElement) return null; + if (parentNode != document.documentElement) return null; return res; } \ No newline at end of file