title: Toggle width with jQuery
body: <p>How do I toggle the width of a div with animation?  My goal is to change the width when I click on the blue div.</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>$(document).ready(function() {
    $('#toggle-button').click(function() {
      $('#toggle').toggle(function() {
        $('#toggle').animate({
          width: "200px"
        });
      }, function() {
        $('#toggle').animate({
          width: "300px"
        });
      });
    });
  });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>#toggle {
    height: 200px;
    width: 200px;
    background: red;
  }
  
  #toggle-button {
    height: 20px;
    width: 20px;
    background: blue;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.7.2/jquery.min.js"&gt;&lt;/script&gt;
  &lt;div id="toggle-button"&gt;&lt;/div&gt;
  &lt;div id="toggle"&gt;&lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>