Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested selectors #4

Closed
egeloen opened this issue Sep 23, 2012 · 3 comments
Closed

Nested selectors #4

egeloen opened this issue Sep 23, 2012 · 3 comments
Assignees
Labels

Comments

@egeloen
Copy link

egeloen commented Sep 23, 2012

Hey! First, thanks for your jQuery plugin! :)

I'm currently trying to integrate your lib into a build-in Sphinx documentation. All works fine except for nested selectors.

The context use by the plugin follow this structure:

<div id="context">
    <h1>First level title</h1>
    <div>
        <h2>Second level title</h2>
        <div>
            <h3>Third level title</h3>
        </div>
        <h2>Second level title</h2>
        <div>
            <h3>Third level title</h3>
        </div>
    </div>
    <h1>First level title</h1>
    <div>
        <h2>Second level title</h2>
        <div>
            <h3>Third level title</h3>
        </div>
    </div>
</div>

The javascript use in order to tocify the context is:

$(selector).tocify({
    "context":    "#context",
    "selectors":  "h1,h2,h3"
});

The TOC only shows h1.

It seems selectors are defined on the same level in the demo. I don't know if it is the reason of the issue. Anyway, is there a solution?

@gfranko
Copy link
Owner

gfranko commented Sep 24, 2012

Right now, all TOC headers need to be defined at the same hierarchy level. This is due to the way I am using certain jQuery selectors. I will leave this issue open as I spend some time finding a better solution. Feel free to make a pull request as well =)

Also, I just released Tocify v0.7.0. Make sure to upgrade, as I fixed a show/hide bug!

The below HTML hierarchy will work as you expect:

  <div id="context">
    <h1>First level title</h1>
        <h2>Second level title</h2>
            <h3>Third level title</h3>
        <h2>Second level title</h2>
            <h3>Third level title</h3>
    <h1>First level title</h1>
        <h2>Second level title</h2>
            <h3>Third level title</h3>
  </div>

@gfranko
Copy link
Owner

gfranko commented Sep 26, 2012

@egeloen I just released Tocify v0.8.0, so try that out. Everything should work for you now.

@gfranko gfranko closed this as completed Sep 26, 2012
@egeloen
Copy link
Author

egeloen commented Sep 26, 2012

Just try it and all works fine :) Thanks!

@ghost ghost assigned gfranko Apr 14, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants