[pmwiki-users] Including an Accordion widget

Harald C. haraldc at gmx.net
Tue Feb 15 16:51:48 CST 2011


Hi Hans,

Hans schrieb am / wrote on 15.02.2011 19:20:
> Here is a fix:
> change in the script in function HideDivs(obj)
> line
>       var d = el.getElementsByTagName(\"DIV\");
> to
>       var d = el.getElementsByClassName(\"acc\");
>
> With this fix the class name of the section divs becomes important,
> so you need to use>>acc<<
>
> Replace 'acc' in the script code with whatever class name you prefer
> to use, but then use the class name in all hideable divs.
>
> My improved recipe to come also uses class names to identify the
> section divs, and probably a config variable to choose one's
> preferred class name.

Done this, works fine. Thank you.

To make things more easy for me, I also made the following changes:

Markup('[[##','<[[','/(?>\\[\\[##([0-9]*))\\s+(.*?)\\]\\]/',
   '<a href="#" onclick="Accordion(\'$1\')">$2</a>');

becomes

Markup('[[##','<[[','/(?>\\[\\[##([0-9]*))\\s+(.*?)\\]\\]/',
   '<a class="acclink" href="#accordion" 
onclick="Accordion(\'$1\')">$2</a>');

'<a class="acclink" ' as an easy to use css style hook;
'href="#accordion" ' to return directly to the accordion div after 
clicking a section header instead of going to the top of the page.

Thought that might be useful for your recipe.

Harald





More information about the pmwiki-users mailing list