问题描述
我正在使用modernizr来支持在ie8的媒体查询。
请你提供一个例子来实现这个。
I am looking at using modernizr for supporting media query in ie8.Could you please provide an example to implement the same.
我也看了一下Respond.js,但发现它有点复杂的所有CDN
I also had a look at Respond.js, but found it a bit complex with all the CDN stuff.
任何其他建议也会感激。
Any other suggestions would also be appreciated.
推荐答案
如果要在IE8中使用媒体查询,Respond.js是必需的。这是允许浏览器的媒体查询的polyfill。
Respond.js is mandatory if you want to use mediaqueries in IE8. This is the polyfill that enables media queries for the browser.
Modernizr只提供媒体查询测试。根据doc,在旧的不支持的浏览器中,测试总是返回false。
Modernizr only offer test for mediaqueries. According to the doc, in older non-supporting browser the test will always return false.
另一个替代方法是由Nathan Smith的960gs网格系统的创建者。
Another alternative is adapt.js by Nathan Smith creator of the 960gs grid system.
更新:
Modernizr现在添加支持
这篇关于modernizr for ie8媒体查询支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!