I carefully evaluate the best way to use Modernizr and Respond.js for responsive design, and you have a couple of questions for the community.
First, I understand that when linking Modernizr with Respond. no other encodings or tests are required to support media queries in IE8 and below. In other words, when Respond.js comes with Modernizr, I just need to download Modernizr to my source in order to activate Respond.js. Right?
Secondly, do you think this is the most effective way to achieve support for media queries in IE8 and lower? In fact, I would include a more powerful Modernizr script than is necessary for browsers that already support media queries. Wouldn't it be more appropriate to separate these two scripts and load only Respond.js if the test for media queries is not performed?
Thirdly, if I would like to separate the two scenarios, what do you think is the best way to download Respond.js, if necessary? One option is to use IE's special conditional comment to load the response. Another option is to use yepnope and Modernizr to test support for media queries and downloads. Answer if necessary. Which would be more efficient and reliable.
Finally, if I decided to separate the two scenarios and use Modernizr to load, Reply, if necessary, I came across the following two methods:
<script> yepnope({ test : Modernizr.mq('(only all)'), nope : ['js/libs/respond.min.js'] }); </script>
OR
<script>Modernizr.mq('(min-width:0)') || document.write('<script src="js/libs/respond.min.js"><\/script>')</script>
I found that the second crash is IE8, but it just needs to be rewritten. What technique would you recommend?
Thanks for the help.
javascript html5 css3 modernizr polyfills
dropseed Nov 25 '11 at 20:19 2011-11-25 20:19
source share