Hamster, I have a similar requirement to show/hide large sections of text. I use some simple javascript and css classes, and it works great for our needs. I'm using it to iterate through a collection of objects on a page, but you could certainly do the same thing without them and just adjust the div names, etc. as needed. A simplified version of the code I'm using is below - you might be able to adapt it. **********START CODE*************** {{velocity}} ##Expand/Collapse Button {{html}} <input type="button" onclick="expandCollapseAll()" value="Expand/Collapse All" title="Expand/Collapse All"/></br> {{/html}} #set($entries = $doc.getObjects('XWiki.EntryClass')) ##Start EntryTable #foreach($entry in $entries) (% class="title closed" name="title" id="title$entry.getNumber()" onclick="showHide('title$entry.getNumber()', 'entry$entry.getNumber()'); return false;" %) =$entry.getProperty('Title').getValue()= (% name="entry" id="entry$entry.getNumber()" style="display:none; width:100%;" %) $entry.getProperty('Entry').getValue() #end {{html}} <script type="text/javascript"> function showHide(title, div){ Effect.toggle(div, 'slide'); var titleelem=document.getElementById(title); titleelem.classList.toggle('open'); } function expandCollapseAll(){ var entries=document.getElementsByName('entry'); var titles=document.getElementsByName('title'); for(var x=0; x < entries.length; x++) { Effect.toggle(entries[x], 'slide'); titles[x].classList.toggle('open'); } } </script> {{/html}} {{/velocity}} **************END CODE***************** The custom CSS classes look like the following: *****************START CSS*********** .closed{background:url(icons/silk/bullet_arrow_down.png) left center no-repeat; padding-left: 25px;} .open{background:url(icons/silk/bullet_arrow_up.png) left center no-repeat; padding-left: 25px;} ****************END CSS***************** Let me know if you'd like to see an example in action and I'll send you the URL. Best, aaron On Thu, Sep 20, 2012 at 9:42 AM, Hamster <[email protected]> wrote:
Thanks!
I searched the Extension DB, but not at "Scripatculous fading effects" (collapse and expand) :-)
I can use the ShowHideMacro to show extra information, but it "lacks" a few features: 1) It won't accept any headers (Title1 like "= Show More =" or Title2 like "== Show Less ==") 2) Nested ShowHideMacro's are possible, but they are not acting correctly (the nested ShowHideMacro takes the value of the main ShowHideMacro)
But a cool feature nonetheless!!
-- View this message in context: http://xwiki.475771.n2.nabble.com/Collapsable-sections-on-a-wiki-page-tp7581... Sent from the XWiki- Users mailing list archive at Nabble.com. _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users