Expand/Collapse Widget Demo

Example 1: Basic Information

This is the first example of an expand/collapse widget. Click the header to toggle the content visibility. The widget uses CSS transitions for smooth animations and JavaScript for interactivity.

The content area has a class of 'details' and is controlled by adding/removing the 'expanded' class to animate the max-height and padding properties.

Example 2: Product Features

Feature 1: High-quality construction with durable materials.

Feature 2: Easy-to-use interface that requires minimal setup.

Feature 3: Responsive design that works on all devices.

Feature 4: Regular updates and excellent customer support.

Example 3: FAQ Section

Q: How does the expand/collapse functionality work?

A: The widget uses a combination of CSS transitions for smooth animations and JavaScript event handlers to toggle the visibility of content sections.

Q: Can I customize the animation speed?

A: Yes, you can adjust the transition duration in the CSS by modifying the 'transition' property on the .details class.

Q: Is this accessible?

A: The current implementation uses click events, but you can enhance accessibility by adding keyboard navigation and ARIA attributes.