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

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:


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


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.