tommcfarlin / Collapsible-Menus

[Retired-jQuery] Collapsible Menus is a plugin that makes it easy to create collapsible menus using nested, unordered lists.
http://tommcfarlin.com/collapsible-menus/
20 stars 13 forks source link

Classes are getting updated for li elements instead of ul elements #3

Closed tubsandcans closed 11 years ago

tubsandcans commented 12 years ago

Looking at the source of my UL's I noticed none have expanded/collapsed-menu classes. Only certain LI elements have those classes. This is resulting in some very wonky behavior

tommcfarlin commented 12 years ago

This is by design since the li elements are the ones that are actually expanded or collapsed.

Can you share with me a snippet of your markup and let me know the recreation steps for producing the errors you're seeing? Definitely want to get this patched if it's causing an issue.

tubsandcans commented 12 years ago

Here's a snippet of the markup, sorry its not indented properly. I'll try to describe the behavior. Let's say I have a li with no nested ul and then a li with a nested ul. In order to toggle this latter li, I have to click on the li above it. If this latter li is collapsed, it doesnt get displayed. Only the nested ul of this li should be hidden when its in the collapsed state, right?

          <ul id="collapsibleList">
          <li>http://www.cnn.com
          <li>http://www.cnn.com
          <ul>
          <li>http://www.cnn.com/cnn/programs/
          <ul>
          <li>http://www.cnn.com/programs/
          </ul>
          </li>
          <li>http://www.cnn.com/
          <ul>
          <li>http://www.cnn.com/2012/07/19/us/scalia-morgan-interview/index.html?hpt=hp_bn3
          </ul>
          </li>
          <li>http://www.cnn.com/CNN/Programs
          <li>http://www.cnn.com/cnni/
          <li>http://www.cnn.com/video/
          <ul>
          <li>http://www.cnn.com/about
          </ul>
          </li>
          <li>http://www.cnn.com/US/
          <ul>
          <li>http://www.cnn.com/video/?video/bestoftv/2012/07/20/early-batman-shooting-cell-video.cnn&hpt=us_c1
          <li>http://www.cnn.com/2012/07/19/us/obit-sylvia-woods/index.html?hpt=us_t5
          <li>http://www.cnn.com/2012/07/19/us/manual-car-question-comeback/index.html?hpt=us_t4
          <li>http://www.cnn.com/2012/07/19/justice/tennesee-mosque-lawsuit/index.html?hpt=us_c2
          <li>http://www.cnn.com/2012/07/19/justice/pennsylvania-abduction-attempt/index.html?hpt=us_c2
          <li>http://www.cnn.com/2012/07/18/us/california-city-bankruptcy/index.html?hpt=us_c2
          <li>http://www.cnn.com/2012/07/18/us/boy-scouts-gay/index.html?hpt=us_c2
          <ul>
          <li>http://www.cnn.com/2012/04/24/opinion/granderson-gay-den-leader/index.html
          <li>http://www.cnn.com/2012/01/13/living/girl-scout-boycott/index.html
          </ul>
          </li>
          <li>http://www.cnn.com/2012/07/18/travel/airline-food-screening-expert/index.html?hpt=us_mid
          <li>http://www.cnn.com/2012/07/20/justice/iowa-missing-cousins/index.html?hpt=us_c2
          <li>http://www.cnn.com/2012/07/20/us/gallery/colorado-theater-shooting/index.html?hpt=us_c1
          <li>http://www.cnn.com/2012/07/19/opinion/pearlman-paterno-statue/index.html?hpt=us_mid
          <li>http://www.cnn.com/video/?hpt=us_bn6#/video/bestoftv/2012/07/02/pmt-allyson-felix.cnn
          <li>http://www.cnn.com/Programs/?hpt=us_tv
          <li>http://www.cnn.com/CNN/Programs/?hpt=us_tv
          <li>http://www.cnn.com/SPORT/olympics/?hpt=us_bn6
tommcfarlin commented 12 years ago

There's a bit of malformed markup in what you've provided, so I've tried to clean it up as best as I can (guessing that this is how you'd want it ;).

Here's the HTML:


<ul id="collapsibleList">
    <li>http://www.cnn.com</li>
    <li>http://www.cnn.com</li>
    <li>http://www.cnn.com/cnn/programs/</li>
    <li>
        <ul>
            <li>http://www.cnn.com/programs/</li>
        </ul>
    </li>
    <li>http://www.cnn.com/</li>
    <li>
        <ul>
            <li>http://www.cnn.com/2012/07/19/us/scalia-morgan-interview/index.html?hpt=hp_bn3</li>
        </ul>
      </li>
      <li>http://www.cnn.com/CNN/Programs</li>
      <li>http://www.cnn.com/cnni/</li>
      <li>http://www.cnn.com/video/</li>
      <li>
        <ul>
            <li>http://www.cnn.com/about</li>
        </ul>
      </li>
      <li>http://www.cnn.com/US/</li>
      <li>
        <ul>
            <li>http://www.cnn.com/video/?vådeo/bestoftv/2012/07/20/early-batman-shooting-cell-video.cnn&hpt=us_c1</li>
            <li>http://www.cnn.com/2012/07/19/us/obit-sylvia-woods/index.html?hpt=us_t5</li>
            <li>http://www.cnn.com/2012/07/19/us/manual-car-question-comeback/index.html?hpt=us_t4</li>
            <li>http://www.cnn.com/2012/07/19/justice/tennesee-mosque-lawsuit/index.html?hpt=us_c2</li>
            <li>http://www.cnn.com/2012/07/19/justice/pennsylvania-abduction-attempt/index.html?hpt=us_c2</li>
            <li>http://www.cnn.com/2012/07/18/us/california-city-bankruptcy/index.html?hpt=us_c2</li>
            <li>http://www.cnn.com/2012/07/18/us/boy-scouts-gay/index.html?hpt=us_c2</li>
            <li>
                <ul>
                    <li>http://www.cnn.com/2012/04/24/opinion/granderson-gay-den-leader/index.html</li>
                    <li>http://www.cnn.com/2012/01/13/living/girl-scout-boycott/index.html</li>
                </ul>
            </li>
            <li>http://www.cnn.com/2012/07/18/travel/airline-food-screening-expert/index.html?hpt=us_mid</li>
            <li>http://www.cnn.com/2012/07/20/justice/iowa-missing-cousins/index.html?hpt=us_c2</li>
            <li>http://www.cnn.com/2012/07/20/us/gallery/colorado-theater-shooting/index.html?hpt=us_c1</li>
            <li>http://www.cnn.com/2012/07/19/opinion/pearlman-paterno-statue/index.html?hpt=us_mid</li>
            <li>http://www.cnn.com/video/?hpt=us_bn6#/video/bestoftv/2012/07/02/pmt-allyson-felix.cnn</li>
            <li>http://www.cnn.com/Programs/?hpt=us_tv</li>
            <li>http://www.cnn.com/CNN/Programs/?hpt=us_tv</li>
            <li>http://www.cnn.com/SPORT/olympics/?hpt=us_bn6</li>
        </ul>
      </li>
    </li>
</ul>

And here's the JavaScript:

$('#collapsibleList').collapsible({
    initialCollapse: true
});

I tested this locally and it all works fine so let me know.