Slicebox – A fresh 3D image slider with graceful fallback

Slicebox is a jQuery 3D image slider plugin that makes use of CSS 3D Transforms and provides a graceful fallback for older browsers that don't support the new properties.
Slicebox

With the CSS 3D Transforms we can create some neat effects by transforming elements in three-dimensional space. Slicebox makes use of the 3D transforms properties and allows different kind of effects. The main idea is to create three-dimensional image slices that will rotate and reveal the next image as another side of the 3D object. In case the browser does not support 3D transforms, a simple slider will be used as fallback.

Please note that you can only see the cool 3D effect of Slicebox in a browser that supports those CSS3 properties.

The images used in the demos are by ND Strupler. They are licensed under the Attribution 2.0 Generic (CC BY 2.0).

Usage

In order to use Slicebox, put your images in an unordered list with the class “sb-slider”:

<ul id="sb-slider" class="sb-slider">

	<li>
		<a href="#" target="_blank">
			<img src="images/1.jpg" alt="image1"/>
		</a>
		<div class="sb-description">
			<h3>Creative Lifesaver</h3>
		</div>
	</li>

	<li>
		<img src="images/2.jpg" alt="image2"/>
		<div class="sb-description">
			<h3>...</h3>
		</div>
	</li>

	<li><!-- ... --></li>
	
	<!-- ... -->
	
</ul>

You can use the div with the class “sb-description” to add any kind of description for the respective image. As shown in this example, you can also add an anchor around the image.

Then you can call the plugin with

$('#sb-slider').slicebox();

Options

Slicebox comes with a set of options that you can adjust for various types of effects:

$.Slicebox.defaults = {
	// (v)ertical, (h)orizontal or (r)andom
	orientation : 'v',

	// perspective value
	perspective : 1200,

	// number of slices / cuboids
	// needs to be an odd number 15 => number > 0 (if you want the limit higher, 
	// change the _validate function).
	cuboidsCount : 5,

	// if true then the number of slices / cuboids is going to be random (cuboidsCount is overwitten)
	cuboidsRandom : false,

	// the range of possible number of cuboids if cuboidsRandom is true
	// it is strongly recommended that you do not set a very large number :)
	maxCuboidsCount : 5,

	// each cuboid will move x pixels left / top (depending on orientation). 
	// The middle cuboid doesn't move. the middle cuboid's neighbors will 
	// move disperseFactor pixels
	disperseFactor : 0,

	// color of the hidden sides
	colorHiddenSides : '#222',

	// the animation will start from left to right. The left most 
	// cuboid will be the first one to rotate
	// this is the interval between each rotation in ms
	sequentialFactor : 150,

	// animation speed
	// this is the speed that takes "1" cuboid to rotate
	speed : 600,

	// transition easing
	easing : 'ease',

	// if true the slicebox will start the animation automatically
	autoplay : false,

	// time (ms) between each rotation, if autoplay is true
	interval: 3000,

	// the fallback will just fade out / fade in the items
	// this is the time fr the fade effect
	fallbackFadeSpeed : 300,
	
	// callbacks
	onBeforeChange : function( position ) { return false; },
	onAfterChange : function( position ) { return false; }
};

Check out each example and you will see how to create different behaviors with the options.

Hope you find it useful, feedback is welcome!

Tagged with:

Stay up to date with the latest web design and development news and relevant updates from Codrops.

CSS Reference

Learn about all important CSS properties from the basics with our extensive and easy-to-read CSS Reference.

It doesn't matter if you are a beginner or intermediate, start learning CSS now.

Feedback 180

Comments are closed.
  1. first of all i would like to say this is by far the best slider that i have seen! greate work Pedro.

    i have downloaded the source files and opened them on the latest chrome browser but it doesn’t seem to work, it only shows one image it doesn’t slide to the next image.

    could you please tell me how to fix this.

    thanks!

  2. Incredible, beautiful work. It works well with chrome 13.0.782.220 (Mac).
    Can I put a link on the title or the image? And to make the title always in sight without pressing “info”?

    Thanks and sorry for my English, Elisa.

  3. Amazing stuff here and very sad that FFox doesn’t support it. I wouldn’t use this until at least FFox or IE is able to run the nice script. Thanks a lot for this.

  4. really awesome trick.. Im still newbie in css3, and this is really motivating, thanks a lot for this neat tutorial

  5. Very nice! Thank you, Pedro.
    I especially like the animation speed–it doesn’t get in the way of the user nav-ing between panels.
    BTW, works fine for me in Chrome 13.0.782.220 (win7-64bit). Of course, not in FF. It *should* work in my IE9, but the demo thinks it can’t and doesn’t try.
    C-A-N-‘-T wait for enough of the world to adopt css3 (and canvas/svg) so we can start using these great techniques in the wild!
    –Mark

  6. The Slider looks great!!!
    I´m trying to incorporate it into a WordPress design that I am working on, however I cannot get it to work. Is there anyone else having the same problem? I’ve used the php for referring to current stylesheet….

  7. Hi, first congrats on the great work! It really is cool. Second, I was wondering, if there is an easy adaptation to content elements, like div’s? Any thoughts on that? I was trying to adapt the find(‘img’), but it didn’t work. But I was not trying very hard 😉 Thank you

  8. Nice, however, unsupported system must enable “Override software rendering list” feature on about:flags page when using Chrome.

  9. Stop posting it doesn’t work in Chrome 13.0.782.220. It’s been posted over and over… we get it.