title: Modernizr Media query doesn’t work when resize browser
body: <p>I use a Modernizr media query in JavaScript to change an element margin and add a class "small". My Modernizr media query doesn't work when I resize my browser, but when I refresh the page then it works. I know I can solve this problem using the jQuery <code>$( window ).resize()</code> function, but I want to solve it using a media query. Can any one tell me how I can solve this problem?</p>
  
  <pre><code>&lt;html class="no-js"&gt;
      &lt;head&gt;
          &lt;title&gt;Foundation 5&lt;/title&gt;
          &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"&gt;&lt;/script&gt;
          &lt;script src="modernizr.js"&gt;&lt;/script&gt;
          &lt;script type="text/javascript"&gt;
              $(document).ready(function() {
                  if (Modernizr.mq('(max-width: 767px)')) {
                      $("#secondary").addClass("small");
                      $("#secondary").css("margin", " 25px");
                  }
              });
          &lt;/script&gt;
          &lt;style type="text/css"&gt;
              #primary {
                  width: 300px;
                  height: 200px;
                  background-color: black;
              }
              #secondary {
                  margin: 0 auto;
                  width: 250px;
                  height: 150px;
                  background-color: white;
                  position: absolute;
              }
  
          &lt;/style&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;div id="primary"&gt;
              &lt;div id="secondary"&gt;
  
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>