Respond.JS不工作在IE 8 [英] Respond.JS Not Working in IE 8
问题描述
出于某种原因,似乎响应JS不工作。我在IE 8中使用媒体查询来更改各种尺寸的显示器的背景图像。在IE 8中没有背景,只是一个纯色。
For some reason it appears that respond JS isn't working. I am using Media Queries in IE 8 to change background images for various size monitors. In IE 8 there is no background, just a solid color.
代码如下所示:
<!--[if lt IE 9]>
<script type="text/javascript" src="/js/html5-shiv.min.js"></script>
<script type="text/javascript" src="/js/respond.min.js"></script>
<![endif]-->
媒体查询如下所示:
@media (min-width:769px) and (max-width:1366px){
html, body{
background: url(/images/backgrounds/1366-bg.jpg) no-repeat center top fixed #190303;
background-size:100% auto;
}
}
上述代码不能工作的原因IE 8?有没有另一个JS,我应该尝试使IE 8媒体查询工作?
Is there a reason the above code would not work in IE 8? Is there another JS that I should try to use to make IE 8 Media Queries Work?
注意:似乎html5-shiv可以工作。我在实时Web服务器上测试。
Note: It appears that the html5-shiv does work. I am testing on a live web server.
推荐答案
同样的问题。我发现这是我的加载序列问题,因为我写CSS内联,然后我调用响应js脚本,所以它看起来像
Same problem. I found out it's my loading sequence problem, because I write CSS inline and then I call respond js script, so it looks like
< script type =text / javascriptsrc =js / respond.min.js>< / script>
< link rel =stylesheettype =text / csshref =style.cssmedia =screen/>
应为
< link rel =stylesheettype =text / csshref =style.css media =screen/>
< script type =text / javascriptsrc = js / respond.min.js>< / script>
ALWAYS链接样式表或在js脚本!
这篇关于Respond.JS不工作在IE 8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!