Carousel Test
by Sam Fereday
HTML
<div id="carousel">
<img class="cloud9-item" src="images/1.png" alt="Item #1">
<img class="cloud9-item" src="images/2.png" alt="Item #2">
<img class="cloud9-item" src="images/3.png" alt="Item #3">
<img class="cloud9-item" src="images/4.png" alt="Item #4">
<img class="cloud9-item" src="images/5.png" alt="Item #5">
<img class="cloud9-item" src="images/6.png" alt="Item #6">
</div>
<div id="buttons">
<button class="left">
←
</button>
<button class="right">
→
</button>
</div>
CSS
#carousel .cloud9-item, #buttons button {
cursor: pointer;
}
JavaScript
/*
* Cloud 9 Carousel 2.0.4
* 3D perspective carousel plugin for jQuery/Zepto with a focus on slick
* performance, based on the original CloudCarousel by Professor Cloud.
*
* See the demo and get the latest version:
* http://specious.github.io/cloud9carousel/
*
* Copyright (c) 2015 by Ildar Sagdejev ( http://specious.github.io )
* Copyright (c) 2011 by R. Cecco ( http://www.professorcloud.com )
*
* MIT License
*
* Please retain this copyright header in all versions of the software
*
* Requires:
* - jQuery 1.3.0 or later -OR- Zepto 1.1.1 or later
*
* Optional (jQuery only):
* - Reflection support via reflection.js plugin by Christophe Beyls
* http://www.digitalia.be/software/reflectionjs-for-jquery
* - Mousewheel support via mousewheel plugin
* http://plugins.jquery.com/mousewheel/
*/
;(function($) {
//
// Detect CSS transform support
//
var transform = (function() {
var vendors = ['webkit', 'moz', 'ms'];
var style = document.createElement( "div" ).style;
var trans = 'transform' in style ? 'transform' : undefined;
for( var i = 0, count = vendors.length; i < count; i++ ) {
var prop = vendors[i] + 'Transform';
if( prop in style ) {
trans = prop;
break;
}
}
return trans;
})();
var Item = function( element, options ) {
element.item = this;
this.element = element;
if( element.tagName === 'IMG' ) {
this.fullWidth = element.width;
this.fullHeight = element.height;
} else {
element.style.display = "inline-block";
this.fullWidth = element.offsetWidth;
this.fullHeight = element.offsetHeight;
}
element.style.position = 'absolute';
if( options.mirror && this.element.tagName === 'IMG' ) {
// Wrap image in a div together with its generated reflection
this.reflection = $(element).reflect( options.mirror ).next()[0];
var $reflection = $(this.reflection);
...