Creating Mootools accordion or simple slider/toggler

From Joomla! Documentation
(Difference between revisions)
Jump to: navigation, search
(Created page with "{{review}} Since {{JVer|11.1}}, {{JVer|1.6}} Simple example to create a simple accordion. Can also be used to make a simple slide-toggler (just use 1 link). In this example...")
 
m (version/tutor template with new parameter {{{target|}}} using target=from)
Line 1: Line 1:
 +
{{version/tutor|1.6|platform=11.1|target=from}}
 
{{review}}
 
{{review}}
Since {{JVer|11.1}},  {{JVer|1.6}}
 
 
 
 
Simple example to create a simple accordion. Can also be used to make a simple slide-toggler (just use 1 link).
 
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.
 
In this example all the accordions (slider) are closed by default.

Revision as of 09:38, 9 December 2012


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.

The php code (e.g. inside template):
//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}  );
});
Your html should look like this:
<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>
Personal tools
Namespaces

Variants
Actions
Navigation
Joomla! Sites
Toolbox