title: jQuery onClick: How to toggle different classes based on window size?
body: <p>I've set up this code so that on click of the div. to toggle and remove a class. now i would like to add different classes in different size of windows.
  i wrote the below code but this code is not working.
  here is my code :</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$('.click').click( function() {
    var windowsize = $window.width();
        if (windowsize = 1920) {
      $(".add").toggleClass("new920");
   }
  } );
  $(".click").click(function(){
     var windowsize = $window.width();
        if (windowsize = 1280) {
      $(".add").toggleClass("new280");
   }
  });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.click{ border:1px solid #CCC; width:100px; height:20px;}
   .add{ width:200px; height:300px; background:#ccc;}
   .new920{ background:red !important;}
   .new280{ background:green !important;}</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"&gt;&lt;/script&gt;
  &lt;html&gt;
  &lt;head&gt;
    
  &lt;/head&gt;
  
  &lt;body&gt;
      &lt;div class="click"&gt;click&lt;/div&gt;&lt;br/&gt;
      &lt;div class="add"&gt;Add&lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>