$(window).height() issues in IE and FF

☆樱花仙子☆ 提交于 2019-12-01 19:41:25
Miguel Galves

I had the same problem with Firefox, and I solved it adding to all my HTML files. The solution was pointed out in this stack overflow question:

Why does Firefox return 0 as the value of $(window).height()

The jQuery 1.8.1 release notes say

Don’t use Quirks mode! jQuery has never supported Quirks mode and we do not perform any testing in Quirks. This can affect values like $("window").height(), and the jQuery 1.8 Quirks mode results did change in order to support some modern browser features. The majority of problem cases we’ve seen are from developers that wanted to be in Standards mode but had an invalid doctype or extraneous markup before their tag. When in doubt, use the simple and short .

Majid Laissi

Try innerHeight() or outerHeight() instead of height()

The padding / borders / margins may not be included

Please have a look at this blog. He made a very detailed research about screen measurements within the browser

http://tripleodeon.com/2011/12/first-understand-your-screen/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!