3D Gallery with CSS3 and jQuery

Today, we want to share an experimental 3D gallery with you that uses CSS 3D transforms.

3DGallery

View demo Download source

With 3D transforms, we can make simple elements more interesting by setting them into three dimensional space. Together with CSS transitions, these elements can be moved in 3D space and create a realistic effect. Today, we want to share an experimental 3D gallery with you that uses CSS 3D transforms.

The main idea is to create a circular gallery where we have an image in the center and two on the sides. Since we are using perspective, the two lateral images will appear three dimensional when we rotate them.

Please note that this will only work in browsers that support CSS 3D transforms.

How it works

The following HTML structure is used for the gallery:

<section id="dg-container" class="dg-container">
	<div class="dg-wrapper">
		<a href="#">
			<img src="images/1.jpg" alt="image01">
			<div>http://www.colazionedamichy.it/</div>
		</a>
		<a href="#">
			<!-- ... -->
		</a>
		<!-- ... -->
	</div>
	<nav>	
		<span class="dg-prev"><</span>
		<span class="dg-next">></span>
	</nav>
</section>

And this is how the gallery is initialized:

$('#dg-container').gallery();

Options

The following options are available:

current		: 0,	
// index of current item

autoplay	: false,
// slideshow on / off

interval	: 2000  
// time between transitions

I hope you enjoy it!

View demo Download source

Previous:
Next:

Tagged with:

Related Articles

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 69

Comments are closed.
  1. 2

    Upfff ……………………. I don’t like it. I love it……………….great looking for this type of articles.

  2. 5

    Laggy in Firefox 10.0. When the page loads the left and right images are on top of the center image. Sometimes the left image disappears. Works great in Chrome.

  3. 6

    On Opera it works just for one slide and then it’s not working, also laggy. “Invalid value for property: zoom”

  4. 10

    Amazing.
    I noticed your email envelope icon link is broken.

    I wanted to thank you for your tutorials. I merged your tutorial with Fotobook plugin for WordPress and I made a nice looking plugin.
    I gave you credit of course.
    http://socialblogsitewebdesign.com/wordpress_plugins/darkroom-facebook-photo-gallery

    A quick question: Is it normal for jQuery to quit on a few tens of webkit rotations?
    The above script randomly fails to rotate all the pictures (added my -1 index for the inner-shadow to render on top of the images makes the non-rotated images to dissapear)
    I found out the script is susceptible to any JS error. Even the layer.eventX deprecated (jQuery?) warning prevents the foreach script to finish rotating the images.
    I’d appreciate you take a look at the code.

    Do you have a effective way to make a mouseleave to “wait” a few seconds based on two readings of the mouse proximity to the element?
    I’ve been trying to make the mouseentered image to “figure out” whether the pointer is approaching or not so it can wait in the hovered state a second, to prevent the rotating image moving away the pointer stuttering the mounseenter-leave-enter effect, without affecting the quick hover-out reaction if the pointer is just passing-by.

  5. 13

    nice…is there any way to stop it from changing the weight and opacity of all the fonts on the rest of my page?

  6. 14

    Hey great 3d effect. I always check this site and always find something that is pleasing to my eyes. i have seen some effects like this but that was 3D accordion. This is the first time i have come across gallery. Really nice, small and sweet tutorial as well.

  7. 18

    Hi Pedro

    Nice post, I haven’t experimented with css transitions yet but it is defiantly something I am looking to incorporate in future design work. I have used a similar effect recently but the jquery roundabout plugin I opted for caused numerous conflict issues in other areas of the site. Time for a change I think.

  8. 19

    This is far from being great. It does not work in neither Firefox nor Opera. It degrades gracefully (no 3D effect) in IE, though. Until it does not work in common browsers, it’s useless for real websites. Do not build a Webkit-only Web! Just DON’T!

Comments are closed.