Skip to content

Nested selectors #4

Closed
Closed

Description

@egeloen

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?

Activity

  1. gfranko commented on Sep 24, 2012

    @gfranko
    Owner

    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>
  2. gfranko commented on Sep 26, 2012

    @gfranko
    Owner

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

  3. egeloen commented on Sep 26, 2012

    @egeloen
    Author

    Just try it and all works fine :) Thanks!

  4. ghost assigned on Apr 14, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions