Bug Tracker

Ticket #4155 (closed bug: worksforme)

Opened 6 years ago

Last modified 3 years ago

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


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

comment:1 Changed 6 years ago by dmethvin

  • Owner set to brandon
  • Component changed from unfilled to dimensions

comment:2 Changed 5 years ago by rwaldron

  • Priority changed from major to high
  • Status changed from new to open
  • Milestone changed from 1.3.2 to 1.5

comment:4 Changed 5 years ago by rwaldron

#4335 is a duplicate of this ticket.

Note: See TracTickets for help on using tickets.