title: Expand/Collapse All with a nested accordion and non-accordion item: BOOTSTRAP
body: <p>I'm about 2 months new to programming and Twitter Bootstrap, so please be kind! </p>
  
  <p>I've done a lot of digging and searching, but am not sure I am using the correct terms so I figure I'd ask directly.</p>
  
  <p>I am trying to create an Expand/Collapse all button that will expand or collapse all items under a Title Header.  The items under a title header include a text piece and an image.  I want to be able to expand/collapse the text piece by clicking on the Title Header.  I want to be able to expand/collapse the text AND the image by clicking on the button.  </p>
  
  <p>The problem is: I want to button to expand/collapse everything regardless if the text piece is expanded or collapsed.</p>
  
  <p>This is the jsfiddle: <a href="http://jsfiddle.net/mcfly303/XXXYn/1/" rel="nofollow">http://jsfiddle.net/mcfly303/XXXYn/1/</a></p>
  
  <p>As you can see, the button will toggle items open or closed opposite of their current state.  Is there a way to do a "universal" expand/collapse, regardless if the nested items are expanded or collapsed?</p>
  
  <p>Basically I'd like the "toggle all" button to result only in a) the title or b) the title and the image.  </p>
  
  <p>Thanks in advance for any help!!!!</p>
  
  <p>my html:</p>
  
  <pre><code>&lt;div class="well sidebar-nav" id="sidebar"&gt;
      &lt;ul class="nav nav-list"&gt;
          &lt;li&gt;&lt;a href="#" class="expandcollapse"&gt;Toggle All&lt;/a&gt;
  
          &lt;/li&gt;
      &lt;/ul&gt;
  &lt;/div&gt;
  &lt;div class="accordion" id="accordion1"&gt;
      &lt;div class="accordion-group"&gt;
          &lt;div class="row-fluid"&gt;
             &lt;div class="span9"&gt;
                  &lt;div class="accordion-heading"&gt; &lt;a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion1" href="#collapseOne"&gt;
                                      &lt;h2&gt;COOL HAND LUKE&lt;/h2&gt;
                      &lt;/a&gt;
  
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div id="collapseOne" class="accordion-body collapse"&gt;
              &lt;div class="accordion-inner"&gt;
                 &lt;div class="mainList"&gt; &lt;a href="#"&gt;Paul Newman Movies&lt;/a&gt;  &lt;a href="#"&gt; &lt;i class="icon-white icon-th-list"&gt;&lt;/i&gt;&lt;/a&gt;
  
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;div id="collapseMain" class="accordion-body collapse in"&gt;
      &lt;div class="accordion-inner"&gt;
          &lt;div class="row-fluid"&gt;
              &lt;div class="span12"&gt;
                  &lt;img src="http://www.samefacts.com/wp-content/uploads/2012/12/CoolHandLuke_135Pyxurz.jpg" alt=""&gt;
  
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>my javascript:</p>
  
  <pre><code>$('.expandcollapse').click(function () {
  
      $('.collapse').each(function (index) {
          $(this).collapse("toggle");
      });
  });
  </code></pre>
  
  <p>EDIT:  So I partially figured it out.  jsfiddle: <a href="http://jsfiddle.net/mcfly303/XXXYn/4/" rel="nofollow">http://jsfiddle.net/mcfly303/XXXYn/4/</a>
  I split to button into two separate buttons to clearly label each function I want to achieve.However, there is still a kink. Namely on loading, the FIRST CLICK on the Title View button will toggle the text open and the picture closed.  And also on load, the first click on the Title and Image button will toggle the text open and keep the image open.</p>
  
  <p>After the first click, everything works fine, which to clarify  (and edit my misstatement above) is:
  Click on TITLE VIEW - collapses all except the Title.  Click on the Title will expand/collapse the text piece
  Click on TITLE AND IMAGE VIEW - expands to Title and Image.  Click on the Title will expand/collapse the text piece</p>
  
  <p>If anyone can please help with this last kink of the "first click problem" I would really appreciate it!</p>
  
  <p>Thanks.</p>