title: Twitter bootstrap accordion collapse function
body: <p>I am using twitter bootstrap css and js frameworks. In this example I have two collapsible divs,  and . </p>
  
  <p>Currently both divs can be expanded at the same time.</p>
  
  <p>The way I would like them to work is so only one div can be expanded at a time. E.g. if #about is expanded and the user clicks #videos, #about will be collapsed and #videos will be expanded in its place.</p>
  
  <p>Is there an easy way to do this?</p>
  
  <pre><code>&lt;div id="main" class="span12"&gt;
        &lt;div class="row"&gt;
  
           &lt;div class="span4"&gt;
              &lt;a href="#" data-target="#about" data-toggle="collapse"&gt;
                  &lt;div class="unit red bloat"&gt;
                     &lt;h3&gt;About&lt;/h3&gt;
                       &lt;p&gt;A Melbourne based social clan who enjoy a range of MMO, RTS and action based titles. Take a look at what we're all about.&lt;/p&gt;
  
                  &lt;/div&gt;
              &lt;/a&gt;
           &lt;/div&gt;
  
           &lt;div class="span4"&gt;
              &lt;a href="#" data-target="#videos" data-toggle="collapse"&gt;
                  &lt;div class="unit red bloat"&gt;
                     &lt;h3&gt;Videos&lt;/h3&gt;
                      &lt;p&gt;A selection of our best videos, of both the good times and the bad. Due to the poor nature of it's content, viewer discretion is advised and should not be viewed by anyone. &lt;/p&gt;
  
                  &lt;/div&gt;
              &lt;/a&gt;
           &lt;/div&gt;
  
           &lt;div class="span4"&gt;
              &lt;a href="forums/index.php"&gt;
                   &lt;div class="unit grey bloat"&gt;
                  &lt;h3&gt;Forum&lt;/h3&gt;
                    &lt;p&gt;If you think you'd fit in here, click this box and sign up to our forum. &lt;/p&gt;
  
                   &lt;/div&gt;
              &lt;/a&gt;
           &lt;/div&gt;
  
  &lt;/div&gt;&lt;!-- end row --&gt;
  
              &lt;br /&gt;
              &lt;br /&gt;
  
               &lt;div class="row-fluid"&gt;
                  &lt;div class="span12"&gt;
  
                  &lt;!-- start accord --&gt;
  
          &lt;div id="about" class="collapse"&gt;
              &lt;div class="row-fluid"&gt;
                  &lt;div class="expanded"&gt;
                      &lt;p&gt;about&lt;/p&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  
          &lt;div id="videos" class="collapse"&gt;
              &lt;div class="row-fluid"&gt;
                  &lt;div class="expanded"&gt;
                      &lt;p&gt;vid&lt;/p&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  
  
  
                  &lt;!-- end accord --&gt;
  
                  &lt;/div&gt;
              &lt;/div&gt;
  
  
  
  
  
  
        &lt;hr&gt;&lt;!-- Bottom border --&gt;
  
  
  
      &lt;/div&gt; &lt;!-- /container --&gt;
  </code></pre>