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

Collapsible TOC #19

Closed
CopticMonk opened this issue Feb 1, 2011 · 4 comments
Closed

Collapsible TOC #19

CopticMonk opened this issue Feb 1, 2011 · 4 comments

Comments

@CopticMonk
Copy link

I'm trying to modify the Table of Contents in the 'totc' example to be able hide/unhide child nodes when I click on the parent. So in the TOC, if i have:
-Title1

---Subtitle_1a

---Subtitle_1b

-Title2

Clicking on Title1 would hide the subtitles and clicking again would unhide it. I tried modifying parts of the contents.js, but was unable to achieve this thus far.

I'm new to Javascript so any tips/instructions would be much appreciated.
If this isn't the right place to ask the question, please let me know where I could get help.

Thanks!

@joseph
Copy link
Owner

joseph commented Feb 15, 2011

Take a look at Monocle.listenForTap as a way to easily support mouse and touch events. It's in src/events.js.

You'd want to more or less copy & paste the code of the contents control and modify it to your intentions — they're not really designed for extensibility, but they're small and atomic enough to duplicate.

It's not clear how your interface works — if clicking on Title1 shows/hides the child headings, instead of navigating to Title1 in the book, how do you navigate to Title1? You could put arrow icons to the side of chapters with children, and put the tap event listeners on those icons.

I can't think of a way to answer this with any greater specificity.

@Yos-A
Copy link

Yos-A commented Feb 16, 2011

I have same question. I want subtitle to disappear and appear. I can do arrow on side of title, but dont understand how to do it.

@CopticMonk
Copy link
Author

Thank you Joseph. I will look at it and give this another shot. To answer your question regarding my interface, I could use the arrow icons idea so that clicking on the arrow expands and collapses the titles/subtitles. The reason, it didn't matter to me whether or not clicking on Title1 takes you to the right place in the book is that the books I am working with all have a Title followed by the 1st subtitle right under it.

If you have any more tips on implementing the arrow solution, please let me know. Thanks again!

@joseph
Copy link
Owner

joseph commented Mar 6, 2011

Closing this one.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants