Bug Tracker

Opened 14 years ago

Closed 12 years ago

Last modified 11 years ago

#4155 closed bug (worksforme)

$(window).width() and $(window).height() incorrect in Safari/Webkit

Reported by: jasonmp85 Owned by: brandon
Priority: low Milestone: 1.5
Component: dimensions Version: 1.3.1
Keywords: dimension window height width safari webkit Cc:
Blocked by: Blocking:


Using Safari/Webkit (I use the latest nightly, but I've confirmed this with latest stable Safari as well), calling $(window).width() and $(window).height() returns incorrect values as compared to the values returned in other browsers and those returned from JQuery 1.2.6 in Safari.

This breaks numerous plugins that rely on this behavior, one of which being Slimbox. For instance, take this webpage:


It uses JQuery 1.2.6 and the Slimbox positioning is correct. Now consider:


Exact same markup, this time using JQuery 1.3.1. Slimbox positions the popup off the bottom of the viewport. Why? Compare the $(window).(width|height)():

testcase (using 1.3.1):


home (using 1.2.6):


An interesting thing to note is that while resizing the window results in different values for the 'home' page, the values for 'testcase' stay fixed. Both pages work correctly in Mac FF3. Also, I'm fairly certain that 960 is the width of my fixed-width layout, so it is telling that $(window).width() should always report this.


Change History (4)

comment:1 Changed 14 years ago by dmethvin

Component: unfilleddimensions
Owner: set to brandon

comment:2 Changed 12 years ago by Rick Waldron

Priority: majorhigh
Status: newopen

comment:4 Changed 12 years ago by Rick Waldron

#4335 is a duplicate of this ticket.

Note: See TracTickets for help on using tickets.