Carousel Widget: Image and Text Example
This example uses the YUI Carousel Widget to showcase an example where each (list) item contains and image and some text. As always, you can use arrow keys to select items, as well as click on an item to select it.
Also in this example, you will see the animation capabilities available in the YUI Carousel Widget. For getting an animated effect during scroll, you will have to set the "animation" configuration setting in the YUI Carousel Widget's constructor, apart from including the YUI Animation utility.
-
-
Leslie Baumann, M.D.
Skin Treatments for…
Posted Thu 5.1.08 -
Deepak Chopra, M.D.
How You Think About Illness…
Posted Thu 5.1.08 -
Christine McKinney, M.S., R.D., C.D.E.
Fat: How Much Is Enough of a…
Posted Thu 5.1.08 -
Dr. Maoshing Ni
Centenarian Tips for a Long…
Posted Tue 4.29.08 -
Lillie Shockney, R.N., M.A.S.
Are You Being Over- or…
Posted Tue 4.29.08 -
David Neubauer, M.D.
Could a Breast Cancer…
Posted Tue 4.29.08 -
Jennifer Tuma-Young
Relieve Stress With Your…
Posted Mon 4.28.08 -
Lucy Danziger, SELF Edit
De-Stress in Mere Minutes
Posted Mon 4.28.08 -
Simeon Margolis, M.D., Ph.D.
Alzheimer's and Dementia: Will…
Posted Mon 4.28.08 -
Mallika Chopra, IntentBlog
Treating a Sore Throat
Posted Mon 4.28.08 -
Using the Carousel Widget for displaying items with images and text
This example has the following dependencies:
This example uses progressive enhancement. So, the Carousel is created from an "ordered" list of elements.
Apart from setting the height of the Carousel, we have some more CSS rules to position the text and the images within the Carousel items.
Since we have the elements in place, we can invoke the Carousel's constructor to create the widget. We'll pass an additional argument to the constructor, to set the animation speed. The "animation" configuration setting is an object that takes in the speed (to scroll) in seconds, and the animation effect.
Lets assemble everything together. The full JavaScript reads as follows: