This is probably a really basic question but I'm having troubles with it. I want to create a passage that has expandable/collapsible text within it. Basically, I have a passage that is a fictional magazine article with several headings/sections within. The entire article on one page is a bit overwhelming for a reader, but it does need to be read in a linear manner. So I thought of having the headings as a list of links, and clicking on the heading would expand its section's text (clicking again collapsing it). Kind of like how Wikipedia works on mobile devices.
Googling this brought me a lot of javascript options but I can't seem to get any of them to work correctly. I'm new to twine and javascript, though. Is there a simple way of doing this that I am missing? Thanks for any help!
Comments
the links take me to generic documentation page.
pls help
1. Place the following In your story's stylesheet tagged passage.
2. Use code like the following within your story passage.
Note that the first parameter of the toggleclass macro is the same as the ID as the related div element with a hash character added to the start of the ID to let the toggleclass macro know that it is an ID of an HTML element.
Each HTML (div) element within the same passage must have an unique ID.
sorry.
i do have a follow up question. how do i change the title of the link text every time it is toggled.
thanks in advance.