Tuesday, June 4, 2024
 Popular · Latest · Hot · Upcoming
21
rated 0 times [  26] [ 5]  / answers: 1 / hits: 18994  / 13 Years ago, mon, march 28, 2011, 12:00:00

What is the difference between screen.width and screen.availwidth in JavaScript?



On my system both are the same!


More From » width

 Answers
106

Some things block some of your viewport, such a history/bookmarks side panel. This includes the taskbar, unless it's on Autohide



Then window.screen.width != window.screen.availWidth. :)



If you are drawing things to the viewport, you ought to use availWidth / availHeight to determine if things are off the viewport etc. Be sure to recalculate on window resize otherwise you won't know when the sidepanel has been closed.




Note that not all of the width given by this property may be available to the window itself. When other widgets occupy space that cannot be used by the window object, there is a difference in window.screen.width and window.screen.availWidth.




Source.


[#93046] Friday, March 25, 2011, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
mckinley

Total Points: 15
Total Questions: 101
Total Answers: 94

Location: Liechtenstein
Member since Fri, Sep 11, 2020
4 Years ago
mckinley questions
Sun, Oct 17, 21, 00:00, 3 Years ago
Tue, Jun 15, 21, 00:00, 3 Years ago
Thu, Apr 8, 21, 00:00, 3 Years ago
;