【发布时间】:2013-04-22 12:10:50
【问题描述】:
我想根据窗口大小设置 DIV 的高度,但 $(window).height() 在 IE10 中返回 0,它在 IE8 和 IE9 中工作正常。为什么?
我也写了如下的doctype声明
<!--[if IE]>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">`
<![endif]-->
如果我删除“<!--[if IE]>”和“<![endif]-->”,那么它工作正常。为什么?请解释。
【问题讨论】:
-
你的 DOCTYPE 是什么?
-
jQuery 的 $(window).height() 对 doctype 很敏感。你的是什么?
-
+1 到上面的 cmets。还有你用的是什么版本的jQuery?
-
doctype 是 ttp://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" rel="nofollow" target="_blank">w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
jquery版本为jQuery v1.8.3
标签: javascript jquery internet-explorer-10