#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: |
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
Change History (4)
comment:1 Changed 14 years ago by
Component: | unfilled → dimensions |
---|---|
Owner: | set to brandon |
comment:2 Changed 12 years ago by
Milestone: | 1.3.2 → 1.5 |
---|---|
Priority: | major → high |
Status: | new → open |
comment:3 Changed 12 years ago by
Priority: | high → low |
---|---|
Resolution: | → worksforme |
Status: | open → closed |
Confirmed
http://gyazo.com/461b100731057ffeb99d20c6dd3c4174.png