[pmwiki-users] Including an Accordion widget

Hans design5 at softflow.co.uk
Fri Feb 18 06:46:21 CST 2011

Tuesday, February 15, 2011, 10:51:48 PM, Harald C. wrote:

> 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.

I updated the recipe to get this behaviour:
Since one does not need a wrapper div with id=accordion,
I added a name to the accordion links, which has a serial number
(so each link has a unique name).
I also added a config setting $AccordionConfig['a-jump'].
Set this to 1 to get  a "jump" behaviour:
clicking  a link will open the section and pt the link to the top of
the window.
I put the default to 0. This has the effect that the page will not jump
and stays as is, just the section opens.
No more jumping to the top of the document in either case.

Please let me know which behaviour might be the best as a default
(in case you use this recipe and not the slightly simpler first
version with link numbering)!



More information about the pmwiki-users mailing list