Side navigation
#1121 closed bug (wontfix)
Opened April 12, 2007 12:58AM UTC
Closed March 31, 2008 02:14AM UTC
iutil.js (Interface version 1.2) - getScroll() incorrect 0 scrollTop and scrollLeft offset for IE 5.5
Reported by: | rbygrave | Owned by: | stefan |
---|---|---|---|
Priority: | minor | Milestone: | 1.1.3 |
Component: | interface | Version: | 1.1.2 |
Keywords: | scrollTop scrollLeft | Cc: | |
Blocked by: | Blocking: |
Description
It seems to me that the getScroll() method of iutil.js may have a bug with IE5.5 (unable to test IE6 yet).
More specifically the scrollTop and scrollLeft (t and l variables) return 0 values when they should not.
After reviewing the 'scrolling offset' section from...
http://www.quirksmode.org/viewport/compatibility.html
Using the code from the quirksmode site seems to fix the issue for me. The code that works to calculate scrollTop and scrollLeft correctly is...
var x,y;
if (self.pageYOffset) all except Explorer
{
x = self.pageXOffset;
y = self.pageYOffset;
}
else if (document.documentElement && document.documentElement.scrollTop)
Explorer 6 Strict
{
x = document.documentElement.scrollLeft;
y = document.documentElement.scrollTop;
}
else if (document.body) // all other Explorers
{
x = document.body.scrollLeft;
y = document.body.scrollTop;
}
return {x:x, y:y};
Attachments (2)
Change History (2)
Changed April 12, 2007 02:46AM UTC by comment:1
Changed March 31, 2008 02:14AM UTC by comment:2
description: | It seems to me that the getScroll() method of iutil.js may have a bug with IE5.5 (unable to test IE6 yet).\ \ More specifically the scrollTop and scrollLeft (t and l variables) return 0 values when they should not.\ \ After reviewing the 'scrolling offset' section from...\ http://www.quirksmode.org/viewport/compatibility.html\ \ Using the code from the quirksmode site seems to fix the issue for me. The code that works to calculate scrollTop and scrollLeft correctly is...\ \ var x,y;\ if (self.pageYOffset) // all except Explorer\ {\ x = self.pageXOffset;\ y = self.pageYOffset;\ }\ else if (document.documentElement && document.documentElement.scrollTop)\ // Explorer 6 Strict\ {\ x = document.documentElement.scrollLeft;\ y = document.documentElement.scrollTop;\ }\ else if (document.body) // all other Explorers\ {\ x = document.body.scrollLeft;\ y = document.body.scrollTop;\ }\ return {x:x, y:y};\ → It seems to me that the getScroll() method of iutil.js may have a bug with IE5.5 (unable to test IE6 yet). \ \ More specifically the scrollTop and scrollLeft (t and l variables) return 0 values when they should not. \ \ After reviewing the 'scrolling offset' section from... \ http://www.quirksmode.org/viewport/compatibility.html \ \ Using the code from the quirksmode site seems to fix the issue for me. The code that works to calculate scrollTop and scrollLeft correctly is... \ \ var x,y; \ if (self.pageYOffset) // all except Explorer \ { \ x = self.pageXOffset; \ y = self.pageYOffset; \ } \ else if (document.documentElement && document.documentElement.scrollTop) \ // Explorer 6 Strict \ { \ x = document.documentElement.scrollLeft; \ y = document.documentElement.scrollTop; \ } \ else if (document.body) // all other Explorers \ { \ x = document.body.scrollLeft; \ y = document.body.scrollTop; \ } \ return {x:x, y:y}; \ |
---|---|
resolution: | → wontfix |
status: | new → closed |
Interface is no longer supported; consider switching to jQuery UI.
I have attached a test case... (that also requires jquery-1.1.2.js)
Note that if there is no doctype then Firefox 2 goes into quicks mode, and in this mode getScroll() incorrectly returns 0 for scrollLeft and scrollTop.
The test case html also includes javascript code that seems to always return the correct values for scrollLeft and scrollTop (t and l) no matter if there is a doctype or not, and also for IE5.5.
To reproduce you need to make the browser window small enough that scroll bars appear, and scroll the window left and down a little bit (so that scrollLeft and scrollTop should NOT be 0), and then click on the 'viewport' link. This gets and checks the getScroll() results and alerts if it thinks there is an incorrect value.