title: jQuery Window Width else if statement
body: <p>I am wondering why my last else if statement never gets executed. I am trying to do this:</p>
  
  <pre><code>$(document).ready(function() {
      function checkWidth() {
          var windowSize = $(window).width();
  
          if (windowSize &lt;= 479) {
              console.log("screen width is less than 480");
          }
          else if (windowSize = 480 &amp;&amp; windowSize &lt;= 719) {
              console.log("screen width is less than 720 but greater than or equal to 480");
          }
          else if (windowSize = 720 &amp;&amp; windowSize &lt;= 959) {
              console.log("screen width is less than 960 but greater than or equal to 720");
          }
          else if (windowSize &gt;= 960) {
              console.log("screen width is greater than or equal to 960");
          }
      }
  
      // Execute on load
      checkWidth();
      // Bind event listener
      $(window).resize(checkWidth);
  });​
  </code></pre>
  
  <p>Everything gets logged in the console except for the last else if. What am I doing wrong?</p>
  
  <p>Thanks,</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>For anyone still interested, I highly recommend the enquire.js plugin:</p>
  
  <p><a href="http://wicky.nillia.ms/enquire.js/" rel="nofollow">http://wicky.nillia.ms/enquire.js/</a></p>
  
  <p>Hands down best approach I've found to recognizing media queries in JS.</p>