title: Bootstrap Collapse Accordion - Default Expand/Collapse?
body: <p>I'm using Twitter Bootstrap, with jQuery.</p>
  
  <p>According to the bootstrap docs, if you want the collapsible element open as default you add the additional class "in".  And if you want the collapsible element collapsed as default you style the height to 0px.</p>
  
  <p>That all works well and good.</p>
  
  <p>I would like to use a Media Query to set the element open as default on large screens, and collapsed as default on small screens (and then click to toggle on both)...</p>
  
  <p>My HTML:</p>
  
  <pre><code>&lt;div class="accordion" id="accordion1"&gt;
   &lt;div class="accordion-group"&gt;
    &lt;div class="accordion-heading"&gt;
     Heading text.
     &lt;a class="accordion-toggle" data-toggle="collapse" href="#collapseOne"&gt;
      (Click to show/hide)
     &lt;/a&gt;
    &lt;/div&gt;
    &lt;div id="collapseOne" class="accordion-body collapse"&gt;
     &lt;div class="accordion-inner"&gt;
      Lorem ipsum.
     &lt;/div&gt;
    &lt;/div&gt;
   &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>My CSS:</p>
  
  <pre><code>@media (min-width: 768px) {
      .collapse {
          height: auto;
      }
  }
  @media (max-width: 767px) {
      .collapse {
          height: 0px;
      }
  }
  </code></pre>
  
  <p>This works fine until you start clicking it…</p>
  
  <p>Below 767px the element is collapsed as default, and above the element is open as default.  Correct.</p>
  
  <p>Below 767px you can click to open the element, and it opens fine.  Click again and it hides.  Rinse and repeat.  Correct.</p>
  
  <p>Above 767px when you click to collapse the element, it closes but then re-opens itself.  Click it again and it closes and stays closed this time.  Click again and it opens fine.  Click again and it closes fine.</p>
  
  <p>So for some reason above 767px (when the element is open as default), it takes two clicks to make it stay collapsed without re-opening itself, and then it works fine.</p>
  
  <p>Thoughts?</p>