Fix incorrect offset in Element.viewportOffset on IE < 8.
(cherry picked from commit 3afb0002cbd31726187338c5119657b76111f80c)
This commit is contained in:
parent
62d0430f3b
commit
c89d6eac95
@ -751,8 +751,13 @@
|
||||
Element.addMethods({
|
||||
viewportOffset: function(element) {
|
||||
element = $(element);
|
||||
var rect = element.getBoundingClientRect();
|
||||
return new Element.Offset(rect.left, rect.top);
|
||||
var rect = element.getBoundingClientRect(),
|
||||
docEl = document.documentElement;
|
||||
// The HTML element on IE < 8 has a 2px border by default, giving
|
||||
// an incorrect offset. We correct this by subtracting clientTop
|
||||
// and clientLeft.
|
||||
return new Element.Offset(rect.top - docEl.clientTop,
|
||||
rect.left - docEl.clientLeft);
|
||||
},
|
||||
|
||||
cumulativeOffset: function(element) {
|
||||
|
Loading…
Reference in New Issue
Block a user