Bug Tracker

Modify

Ticket #1121 (closed bug: wontfix)

Opened 6 years ago

Last modified 5 years ago

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:
Blocking: Blocked by:

Description (last modified by scott.gonzal) (diff)

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

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

Change History

Changed 6 years ago by rbygrave

Changed 6 years ago by rbygrave

Iterface iUtil.js

comment:1 Changed 6 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 5 years ago by scott.gonzal

  • Status changed from new to closed
  • Resolution set to wontfix
  • Description modified (diff)

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

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.