title: jQuery: Disable script based on window width/media query
body: <p>I have the jQuery script below that triggers a div to become floating-fixed. (Which is working and I have no problems with it).</p>
  
  <pre><code>$(document).ready(function() {
      ctop = $('#comment').offset().top - parseFloat($('#comment').css('margin-top').replace(/auto/, 0));
  });
  $(window).scroll(function (event) {
      // what the y position of the scroll is
      var y = $(this).scrollTop();
      var abottom = $('#individual_second_tier').offset().top - parseFloat($('#individual_second_tier').css('margin-top').replace(/auto/, 0));
  
      // whether that's below the form
      if (y &gt;= ctop) {
          // if so, ad the fixed class
          $('#comment').addClass('fixed');
          if (y &gt; abottom-$('#comment').height()){
              $('#comment').offset({'top': abottom-$('#comment').height()-y});
          }
          else
          {
              $('#comment').offset({'top': 0 });
          }
      } else {
          // otherwise remove it
          $('#comment').removeClass('fixed');
      }
      var newWidth = $('#comment').parent().width();
      $('#comment').width(newWidth);
  
      });
  </code></pre>
  
  <p>You can see it in action <a href="http://www.underconsideration.com/brandnew_BUILD/archives/new_logo_and_identity_for_jacksonville_jaguars.php" rel="nofollow">here</a>. It's the gray box on the right that says "Poll"</p>
  
  <p>My site is responsive so when it goes under 768 pixels, the poll div moves down under the blog content. So in full browser width the script works great, but when I resize it the poll  div goes haywire.</p>
  
  <p>I am complete noob when it comes to jQuery -- I am an excellent copy-paster -- but I am imagining that there is a fancy way in the existing script to instruct it to disable it when it matches a media query or browser width, so that I can get rid of the fixed-floating-div functionality.</p>
  
  <p>If anyone wants a local copy to mess with, <a href="http://underconsideration.com/brandnew_BUILD/fixed_floating_div_response_stack_v1.zip" rel="nofollow">here is a zip file</a> with the html file (type will look off as I am using webfonts).</p>