|
Cookbook /
AccordionSummary: lightweight Accordion javascript requiring no framework
Version: 2011-06-29
Prerequisites:
Status: new
Maintainer: HansB
Discussion: Accordion-Talk
Download: accordion.phpΔ
Questions answered by this recipe
DescriptionLightweight javascript functionality for hiding designated sections (using a class name for each div section) while showing just one, by clicking on a header link. This script does not require any javascript framework (like jquery). InstallationDownload accordion.phpΔ, copy to your cookbook folder and install in config.php or a page or group php file in the usual way by adding: include_once('cookbook/accordion.php');
ConfigurationAdd configuration settings before include of the script file! You can set class names for the div sections and the links:
No style atttributes are provided with this recipe, create your own! The default behaviour of hiding all sections but the one which is selected by clicking the link in the header can be changed, so that sections already opened will remain open:
UsageCreate Accordion sections using div markup with class acc (or your custom class specified in config). Directly above each section create a header (using standard header markup of any level) with an Accordion link markup like Accordion link format: [[## link text]]
Use either header markup plus accordion link markup, like !!!![[## Section Heading]]
or wiki style markup plus accordion link markup, like %mystyle%[[## Section Header]]
not header plus style plus aaccordion markup. Example:
!!![[## Section 1]] >>acc<< Section 1 content goes here. Any normal wiki content. >><< !!![[## Section 2]] >>acc<< Section 2 content.... >><< !!![[## Section 3]] >>acc<< Section 3 content.... >><< etc. Instead of using the Additional special link formats:
For the last two use a wrapper div markup as in this example: [[##all: show all]] |[[##none: hide all]] (:div0 class=accordion:) [[##show: show this]] | [[##hide: hide this]] !!![[## Section 1]] >>acc<< Section 1 content... >><< !!![[## Section 2]] >>acc<< Section 2 content.... >><< !!![[## Section 3]] >>acc<< Section 3 content.... >><< (:div0end:) (:div0 class=accordion:) [[##show: show this]] | [[##hide: hide this]] !!![[## Section 4]] >>acc<< Section 4 content... >><< !!![[## Section 5]] >>acc<< Section 5 content.... >><< !!![[## Section 6]] >>acc<< Section 6 content.... >><< (:div0end:) NotesFuture development ideas:
Change log / Release notes
See alsoContributorsCommentsSee discussion at Accordion-Talk User notes +1: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki. |