Bug Tracker

Opened 15 years ago

Closed 14 years ago

#1121 closed bug (wontfix)

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 (last modified by scott.gonzal)

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)

viewport.html (2.2 KB) - added by rbygrave 15 years ago.
iutil.js (6.0 KB) - added by rbygrave 15 years ago.
Iterface iUtil.js

Download all attachments as: .zip

Change History (4)

Changed 15 years ago by rbygrave

Attachment: viewport.html added

Changed 15 years ago by rbygrave

Attachment: iutil.js added

Iterface iUtil.js

comment:1 Changed 15 years ago by rbygrave

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.

comment:2 Changed 14 years ago by scott.gonzal

Description: modified (diff)
Resolution: wontfix
Status: newclosed

Interface is no longer supported; consider switching to jQuery UI.

Note: See TracTickets for help on using tickets.