[pmwiki-users] showhide toggle

Hans design at softflow.co.uk
Sun Mar 5 06:43:14 CST 2006


jr's toc markup inspired me to generalise the toggle link used there,
and create a markup which adds toggle links (in comparison to the toggle
buttons showhide.php adds).

I uploaded the first draft as togglelink.php, and added it to
http://www.pmwiki.org/wiki/Cookbook/ShowHide

I have some questions though:

1. The markup (:toggle div=... :) accepts the same parameters as
showhide, so it is possible to
a) specify the division or object the toggle should =act upon.
b) specify different labels (link names) for individual toggle links,
both for Show and for Hide.
c) set the toggle to initially hide the div instead of the default
showing it.
The script as for the moment has a difficulty with the last:
If init=hide is used the first click will not show the div,
it will show it initially only with the second click on the link.
From there on the toggle works fine.
I have not been able to find a solution for this, so if anyone feels
inspired please help! I find it an important enough feature to be able
to hide a div or object initially.

2. Questions about parameter names: Are there any better names out
there?
2a)  div= to name a division. But it works also on other block objects
like tables, less well on inline objects like span.
Should it better be called obj= ?
2b) init= for the initial state of the object. init=hide hides it.
2c) lshow= and lhide= for the label text (link text).

3. The DOM property used to dynamically insert html via javascript is
innerHTML. This was introduced for IE, although Mozilla browsers
support it as well. Still it is not officially part of the DOM
specification. Does this pose any problems? Does the script need to be
written using a different property?

Any thought on any if this?

-- 
Best regards,
 Hans                          





More information about the pmwiki-users mailing list