J2.5:Creating Mootools accordion or simple slider/toggler
From Joomla! Documentation
| This is a page which: needs review. You can help the Joomla! Documentation Wiki by contributing to it. More pages that need help similar to this one are here. If you feel the need is satistified, please remove this notice. While actively editing, consider adding {{inuse}} to reduce edit conflicts. |
Simple example to create a simple accordion. Can also be used to make a simple slide-toggler (just use 1 link).
In this example all the accordions (slider) are closed by default.
//Add Slide/toggle behavior JHTML::_('behavior.framework',true); $this->document->addScriptDeclaration(' window.addEvent("domready", function( ){ navAcc = new Accordion( $$( ".accordion .accT" ), $$( ".accordion .accE" ), {display: -1, alwaysHide: true} ); });
<div class="accordion"> <a class="accT">Link 1</a> <div class="accE">Container 1</div> <a class="accT">Link 1</a> <div class="accE">Container 2</div> <a class="accT">Link 1</a> <div class="accE">Container 3</div> </div>