From db9975842d1a1be7977355a3cc0875f6d68023dd Mon Sep 17 00:00:00 2001 From: Janusz Dobrowolski Date: Wed, 18 Mar 2009 22:09:59 +0000 Subject: [PATCH] Fix for IE in element_pos() --- js/utils.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 -- 2.30.2