title: Jquery to kick in if screen width is less than 500px
body: <p>I have this code that shows content if clicked. The thing is that this function should only be availible if the screen/device width is 500px maximum.  How would I go about doing this?</p>
  
  <pre><code>$(function () {
      $('.row1').hide();
      $('#show').toggle(function () {
          $('.row1').slideDown("slow");
          $(this).attr("src", "bilder/cancel.png");
      }, function () {
          $('.row1').slideUp("slow");
          $(this).attr("src", "bilder/add.png");
      });
  });
  </code></pre>
  
  <p>UPDATE:
  I didn't do a good job explaining what I wanted to accomplish : / I I want this image to show when the screen width is above 500px. And when the width is less than 500px I want a line that say click here to show image and the image appears</p>