Animated Collapsible DIV
Author: Dynamic Drive
Note: Last updated June 27th, 07'. Added ability for a DIV to be initially expanded.
Description: This script collapses any DIV on the page and lets users manually toggle its appearance via a smooth "Web 2.0 style" animation. It's a popular effect on social networking/ comment sites such as Digg. Three distinguishing features of this script are:
The ability for the script to work on both DIVs that have an explicit CSS height attribute defined, and without. In the later case, the script will first hide (versus collapse) the DIV until retrieving its true height on page load.
A persistence feature that if enabled will remember if a DIV has been expanded, and upon the user's return to the page within the same browser session, keep it expanded.
The duration of the animation is absolute and user configurable, such as 1.5 seconds. This means regardless of the height of the DIV, the script will take 1.5 seconds to finish revealing it. This creates a uniform period before a DIV is revealed regardless of its height.
By default the script will dynamically collapse the DIV in question when the page loads. You can optionally specify that the script leave the DIV expanded instead.