Namespaces
Variants
Actions

DrY Carousel

Jump to: navigation, search
Article Metadata

Code Example
Article
Created: symbianyucca (16 May 2010)
Last edited: hamishwillee (05 Jul 2012)
DrY Carousel component is based on Guarana Button implementation, and its functionality thus is rather similar to the Guarana implementation.

Following code snipped shows how it can be used:

dojo.require("dry.Carousel");
 
function imageSelected(new_value,div_id){
console.log(div_id + " selected item: " + new_value);
}
 
imagesData1 = [{
image: "images/carousel01.jpg"
},{
image: "images/carousel02.jpg"
},{
image: "images/carousel03.jpg"
},{
image: "images/carousel04.jpg"
},{
image: "images/carousel05.jpg"
},{
image: "images/carousel02.jpg"
},{
image: "images/carousel01.jpg"
},{
image: "images/carousel05.jpg"
},{
image: "images/carousel02.jpg"
},{
image: "images/carousel01.jpg"
}];
 
var car1 = new dry.Carousel({
items: imagesData1,
selectedItem: 0,
selected: imageSelected,
itemheight: 83,
itemwidth: 83,
visibleItems: 3,
styleTweaker: styleTweaker},
'controlDiv1');

The constructor takes 2 items, where the second one is the name for the div where the Carousel is placed in. The first argument is a struct defining the Carousel properties and callback functions:

  • items: array of images to be used with the carousel,
  • selectedItem: initially selected image,
  • selected: callback called when image is selected,
  • itemheight: height for individual image item,
  • itemwidth: width for individual image item,
  • visibleItems: amount of visible items in the Carousel,
  • styleTweaker: styleTweaker for handling the themes.


Examples

Go to DrY Index

This page was last modified on 5 July 2012, at 06:45.
110 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved