I have a piece of content….. lets say an FAQ element
This would be the title of the FAQ Element [ expand link here ]
……Once the [expand link] has been clicked it would look like……
This would be the title of the FAQ Element [ collapse link here ]
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent a lectus in sem ullamcorper consequat. Fusce id est felis. Proin condimentum erat in eros consequat eu sollicitudin tortor euismod. Morbi neque turpis, fringilla vitae auctor non, convallis sit amet nulla. In tincidunt, justo non faucibus semper, orci tellus ullamcorper velit, at pulvinar lacus libero et sem. Aliquam erat volutpat. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam a nisi non risus viverra fringilla eu eu quam. Donec auctor justo sed erat euismod sed tempus felis dictum. Praesent in est nibh. Nam malesuada consequat massa id vehicula. Proin consectetur magna quis tellus imperdiet in dignissim tellus adipiscing.
So….. I am looking for a way in Drupal to have a expand/collapse feature…… sort of like how it’s done in the administration panel for like Menu Settings, Comment settings etc…..
Comments
CSS and JavaScript
There's not really a Drupal-way. You can do things with CSS and JavaScript.
Something like this:
If you use CCK to make your
If you use CCK to make your FAQ content type, you could put your "answer" field into a fieldgroup then use display options to make the fieldgroup collapsible and collapsed by default.
Either that ... or a try http://drupal.org/project/collapse_text
The easiest way to do this is
The easiest way to do this is to just use the Collapse Text module located here: http://drupal.org/project/collapse_text.
I use it all over the place in my new site that I'm dev, and it works like a charm. It's VERY easy to setup and use. Before you start your text, write:
[collapse] and end it with [/collapse].
If you want it collapsed by default, then you enter:
[collapse collapsed] end with [/collapse]
To add the title of the collapsed text, just use:
[collapse collapsed title=Title] and end it with [/collapse]
That's it, man. This is one of my favorite mods and it's just such a snap to use. You can see an example on my new site that in dev here: http://tvdelicio.us/help/watching-videos (it's in dev right now, so some things don't work or look out of place... just wanted to give you an example).
Chris
Thank you
Thanks everyone for the all the comments I appreciate it.
Chris that module looks perfect...... I wasn't even looking for the scroll down and scroll up..... i just want it to appear/hide but the scrolling effect is even better!
Thanks so much I looooove Drupal Modules!
-Nate
Missing something?
So I have installed and used dozens of modules without a problem...
I d/led the 6.X version...... extracted into sites/all/modules....... went to admin and enabled the module...
Went to a content page to try it out..... but its just rendering the [collapse] and [/collapse] as plain text on the page... I have tried both input filters...... no luck...
I don't see anything in the users permissions area for this module is there something I am missing?
Thanks,
-Nate
Hey, What editor are you
Hey,
What editor are you using? Sounds like the [collapse] code is being stripped. Make sure you're using full html and check your editor settings... make sure you have it set to NOT strip or clean up html/code. But, of course, make sure you do this only for the admin settings within the editor.
If you're still having a problem, I'd be glad to take a look for ya.
Chris
Hi Chris, Sorry for the
Hi Chris,
Sorry for the delayed response..... this is for work and I am constantly getting pulled to and from projects... so I was using FCKEditor but to help narrow it down I disabled the Module so now I'm just using the standard Drupal plain text editor.. I put in:
This is some text.
Hi![collapse]
This is some more text.
[/collapse]
And......
on: index.php?q=admin/build/modules
under: Input Filters
I have Collapse Text enabled
(Filter is also enabled under Core - required)
So when the page is rendered Drupal is totally ignoring the [ and ] as if they aren't special chars for stuff like this....... any ideas? : (
2 easy ways
re-use the built-in drupal library (As above, you still have to use unfiltered HTML for that to work)
... or use FAQ.module which includes this type of display as an option.
.dan. is the New Zealand Drupal Developer working on Government Web Standards