accordion with YUI javascript library


/ Published in: JavaScript
Save to your folder(s)

For this snippet you need the files: yahoo-dom-event.js and animation-min.js from the Yahoo User Interface Library (version 2.4.1).

Code
To use this snippet add a class "accordion" to a defenition list.
The "DT" will be converted to the clickable headers. The "DD" will be used for the accordion item content. Add a class "open" to an "DD" element which should be open on startup.

Call the main function by putting the code below in a initPage function:

YAHOO.lutsr.accordion.init(true,10,true);

The first parameter sets the animation on/off (default = true), the second represents the ammount of frames the animation should take (default = 10), the last defines if there could be more than one item open at once (default = true).

URL: http://www.lutsr.nl/yui/accordion/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.