title: reduce the width of a div 1% every 100th of a second with jquery
body: <p>I'm trying to use javascript to reduce the <code>width</code> of a <code>&lt;div&gt;</code> from 100% to 1% over the course of 10 seconds but I'm a bit of a learner driver with javascript and jquery so I'm having a bit of a problem.</p>
  
  <p>My code:</p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;div class="timer"&gt;&lt;/div&gt;
  </code></pre>
  
  <p><strong>JavaScript</strong></p>
  
  <pre><code>var i = 100;
  while(i&gt;1) {
      var currentWidth = $(".timer").css(width);
      currentWidth = currentWidth-1;
      setInterval(function()
      {
          $(".timer").width(currentWidth+'%')
      }, 100);
      i--;
  }
  </code></pre>
  
  <p>But it ain't working. I've cobbled it together myself from different places so it could be completely wrong. Can anyone help me out?</p>