-1

I'm running a very simple enquire.js test as per the enclosed and finding that it doesn't get a response from IE9. Several other browsers are responding fine (FF, Chrome, Safari). I've tested the test-suite from GITHUB in IE9 which runs fine - so I must be missing something. Any help appreciated!

<!doctype html>
<html>
 <head>
  <meta charset="utf-8">
  <title>enquire.js test</title>
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width">
</head>
<body>
 <div id="frame">hello</div>
 <script src="js/libs/jquery.1.7.1.js"></script>
 <script src="../dist/enquire.js"></script>
 <script>
  $(document).ready(function(){
enquire.listen(50);
enquire.register("screen and (max-width: 1000px)",
      {
       match : function(){
  $("#frame").css("background-color","#f00");
       },     
       unmatch : function(){
  $("#frame").css("background-color","#0f0");
 },    
     });
   });
 </script>
</body>
</html>

1 Answers1

3

IE9 does not support the matchMedia API so you have to include a polyfill to get it to work. You can add the polyfill to the page however you like, providing it's loaded before enquire. Personally I use Modernizr to conditionally load polyfills, but that's personal preference.

Hope that helps

WickyNilliams
  • 5,218
  • 2
  • 31
  • 43