title: Loading jQuery based on viewport width
body: <p>I have an events calendar that shows all the days of the week in the top row. The calendar itself is responsive, but when it's shrunken down for mobile, the days of the week extend outside of their boxes, and overlap each other – which also creates some width overflow.</p>
  
  <p>I would like to use jQuery to change "Sunday" to "S" when viewed on mobile, but I'm not sure how to go about doing that.</p>
  
  <p>Using the ".replaceWith" command, I've managed to get part of it to work. I just can't figure out how to trigger this script based on the browser width.</p>
  
  <p>Here's my code so far:</p>
  
  <pre><code>$(window).resize(function() {
      if ($(window).width() &lt; 950) {
          $( "div.sunday" ).replaceWith( "S" );
          $( "div.monday" ).replaceWith( "M" );
          $( "div.tuesday" ).replaceWith( "T" );
          $( "div.wednesday" ).replaceWith( "W" );
          $( "div.thursday" ).replaceWith( "T" );
          $( "div.friday" ).replaceWith( "F" );
          $( "div.saturday" ).replaceWith( "S" );
      }
  }
  </code></pre>
  
  <p>Here's the fiddle: <a href="http://jsfiddle.net/CN8Gs/1/" rel="nofollow">http://jsfiddle.net/CN8Gs/1/</a></p>