Side navigation
#4155 closed bug (worksforme)
Opened February 15, 2009 07:07AM UTC
Closed October 26, 2010 08:34PM UTC
Last modified March 14, 2012 03:08PM UTC
$(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: |
Description
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:
http://jasonandrebecca.net/content/home.html
It uses JQuery 1.2.6 and the Slimbox positioning is correct. Now consider:
http://jasonandrebecca.net/content/testcase.html
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):
$(window).width() 960 $(window).height() 1611
home (using 1.2.6):
$(window).width() 1170 $(window).height() 333
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.
--Jason
Attachments (0)
Change History (4)
Changed February 15, 2009 03:59PM UTC by comment:1
component: | unfilled → dimensions |
---|---|
owner: | → brandon |
Changed October 26, 2010 08:19PM UTC by comment:2
milestone: | 1.3.2 → 1.5 |
---|---|
priority: | major → high |
status: | new → open |
Changed October 26, 2010 08:34PM UTC by comment:3
priority: | high → low |
---|---|
resolution: | → worksforme |
status: | open → closed |