Carousel Widget: Reveal Example

This example showcases a simple yet powerful feature of the YUI Carousel Widget. In this example, the Carousel displays the previous and next elements partially giving a sneak peak of the upcoming image to the user. The "revealAmount" configuration setting accepts the percentage of the width of an item to reveal.

In this example, you can use arrow keys to select items, as well as click on an item to select it. This feature is a built-in functionality of the YUI Carousel widget.

Using the Carousel Widget for revealing previous and next items

Here we will use the YUI Carousel Widget's "revealAmount" configuration setting to reveal the previous and next items partially.

This example has the following dependencies:

This example uses progressive enhancement. So, the Carousel is created from an "ordered" list of elements.

We'll have only one CSS rule to set the height for the Carousel items.

Since we have the elements in place, we can invoke the Carousel's constructor with the "revealAmount" configuration to create the widget.

Lets put the pieces together. The full JavaScript reads as follows: