title: Jquery .Animate Width Problem
body: <p>Thanks in advance for any-help with this, I'll try and explain it well.</p>
  
  <p>I have a container of 1000px width and 220px height, in this I will have three columns 220px in height but with different widths (77px, 200px and 300px). When you click one div it will open to a fixed size (the same for each, say 400px) and the others which are not clicked will shrink back to their original sizes (77px, 200px and 300px). Like an accordian with different widths..</p>
  
  <p>My jquery is getting there but not quite, I know how to create an Event on click, I know from there I need to shrink everything but the one I clicked back to their orignal size. I finish but making the one clicked expand to the size it needs to be.</p>
  
  <p><a href="http://jsfiddle.net/sm00p/tfSnL/" rel="nofollow">jsfiddle here!</a></p>
  
  <pre><code>    $(document).ready(function(){
   // Your code here
   $('.section').click(function() {
    $('.section').not(this).animate({width:"77px"},400);
    //alert('clicked!');
    $(this).animate({width:"400px"},400);
   });
  });
  
  &lt;div id="pictureNavContainer"&gt;
  
   &lt;div class="section pictureSectionOne" id="1"&gt;&lt;/div&gt;
   &lt;div class="section pictureSectionTwo" id="2"&gt;&lt;/div&gt;
   &lt;div class="section pictureSectionThree" id="3"&gt;&lt;/div&gt;
  
  &lt;/div&gt;
  
  &lt;style&gt;
  #pictureNavContainer{background-color:#262626; width:1000px; height:220px; overflow:hidden;}
  .pictureSectionOne{float:left; background:yellow; height:220px; width:77px;}
  .pictureSectionTwo{float:left; background:red; height:220px; width:177px;}
  .pictureSectionThree{float:left; background:blue; height:220px; width:400px;}
  &lt;/style&gt;
  </code></pre>
  
  <p>I figured a kind of solution:</p>
  
  <pre><code>&lt;script&gt;
  $(document).ready(function(){
      // Your code here
      $('.section').click(function() {
  
  
  
          $('#1').animate({width:"50px"},400);
          $('#2').animate({width:"100px"},400);
          $('#3').animate({width:"200px"},400);
  
          //alert('clicked!');
          $(this).animate({width:"400px"},400);
      });
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>But the code isnt very good.. but it works</p>
  
  <p>This:</p>
  
  <pre><code>$(function(){
  
      var $sections = $('.section');
      var orgWidth = [];
  
      var animate = function() {
          var $this = $(this);
          $sections.not($this).each(function(){
              var $section = $(this),
                  org = orgWidth[$section.index()];
              $section.animate({
                  width: org
              }, 400);
          });
          $this.animate({
              width: 400
          }, 400);
      };
  
      $sections.each(function(){
          var $this = $(this);
          orgWidth.push($this.width());
          $this.click(animate);  
      });
  });
  </code></pre>