Repository: specious/cloud9carousel
Branch: master
Commit: c25c4ccf21c0
Files: 4
Total size: 25.6 KB
Directory structure:
gitextract_bebdplpu/
├── README.md
├── bower.json
├── jquery.cloud9carousel.js
└── package.json
================================================
FILE CONTENTS
================================================
================================================
FILE: README.md
================================================
# Cloud 9 Carousel
A 3D perspective carousel for jQuery/Zepto focused on performance, based on the [original Cloud Carousel](https://github.com/specious/cloud9carousel/blob/32df63d07096911e3e48b5a721c4c46c1c6f74e8/jquery.cloud9carousel.js) by [Professor Cloud](#authors).
## Features
- Works with [jQuery](http://jquery.com/) and [Zepto](http://zeptojs.com/)
- Extremely fast
- [Easy to use](#basic-usage)
- *(optional)* Reflections (via [reflection.js](http://www.digitalia.be/software/reflectionjs-for-jquery))
- *(optional)* Mouse wheel support (via [mousewheel plugin](http://plugins.jquery.com/mousewheel/)) (see: [known issues](#known-issues))
- *(optional)* Rotate clicked item to front
- *(optional)* Auto-play
- Smooth animation via [requestAnimationFrame](https://developer.mozilla.org/docs/Web/API/window/requestAnimationFrame) with fixed-FPS fallback mode
- GPU acceleration through CSS transforms ([support](http://caniuse.com/transforms) detected automatically)
- Create multiple instances
- Items can be any HTML element
- Convenient [event callbacks](#event-callbacks)
## Demos




View the [examples](https://github.com/specious/cloud9carousel/tree/gh-pages) in the `gh-pages` branch.
## Dependencies
- [jQuery](https://github.com/jquery/jquery) 1.3.0 or later **or** [Zepto](https://github.com/madrobby/zepto) 1.1.1 or later
- Optional mirror effect using the [reflection.js plugin](http://www.digitalia.be/software/reflectionjs-for-jquery) by Christophe Beyls (jQuery only)
- Optional mouse wheel support via the [mousewheel plugin](http://plugins.jquery.com/mousewheel/) (jQuery only)
## Documentation
### Basic usage
HTML:
```html
| Option |
Description |
Default |
| xOrigin |
Center of the carousel (x coordinate) |
(container width / 2) |
| yOrigin |
Center of the carousel (y coordinate) |
(container height / 10) |
| xRadius |
Half the width of the carousel |
(container width / 2.3) |
| yRadius |
Half the height of the carousel |
(container height / 6) |
| farScale |
Scale of an item at its farthest point (range: 0 to 1) |
0.5 |
| mirror |
See: Reflection options |
none |
| transforms |
Use native CSS transforms if support for them is detected |
true |
| smooth |
Use maximum effective frame rate via the requestAnimationFrame API if support is detected |
true |
| fps |
Frames per second (if smooth animation is turned off) |
30 |
| speed |
Relative speed factor of the carousel. Any positive number: 1 is slow, 4 is medium, 10 is fast. Adjust to your liking |
4 |
| autoPlay |
Automatically rotate the carousel by this many items periodically (positive number is clockwise). Auto-play is not performed while the mouse hovers over the carousel container. A value of 0 means auto-play is turned off. See: autoPlayDelay |
0 |
| autoPlayDelay |
Delay, in milliseconds, between auto-play spins |
4000 |
| mouseWheel |
Spin the carousel using the mouse wheel. Requires a "mousewheel" event, provided by this mousewheel plugin. However, see: known issues |
false |
| bringToFront |
Clicking an item will rotate it to the front |
false |
| buttonLeft |
jQuery collection of element(s) intended to spin the carousel so as to bring the item to the left of the frontmost item to the front, i.e., spin it counterclockwise, when clicked. E.g., $("#button-left") |
none |
| buttonRight |
jQuery collection of element(s) intended to spin the carousel so as to bring the item to the right of the frontmost item to the front, i.e., spin it clockwise, when clicked. E.g., $("#button-right") |
none |
| itemClass |
Class attribute of the item elements inside the carousel container |
"cloud9-item" |
| frontItemClass |
Class attribute automatically added to the front-most item element |
none |
| handle |
The string handle you can use to interact with the carousel. E.g., $("#carousel").data("carousel").go(1) |
"carousel" |
### Reflection options
After including [reflection.js](http://www.digitalia.be/software/reflectionjs-for-jquery) in your page, you may pass in options to configure the item reflections. For example:
```js
mirror: {
gap: 12, /* 12 pixel gap between item and reflection */
height: 0.2, /* 20% of item height */
opacity: 0.4 /* 40% opacity at the top */
}
```
*Note:* The **reflection.js** plugin does not work with **Zepto**, but [this unofficial fork](https://gist.github.com/specious/8912678) does!