Here is an example fiddle of what I'm trying to do.
jQuery transit and CSS3 3D transitions are being used in order to rotate 2 divs on click. If you take a look at the fiddle, clicking 'rotate' will change the perspective on the div so 'rotate back' is showing. 'rotate back' is not clickable, as there appears to be some funky z-indexing or positioning going on.
HTML
<div class="masthead">
<div class="face face-1"><span class="rotate">rotate</span></div>
<div class="face face-2"><span class="rotate-back">rotate back</span>
</div>
JS
$(document).ready(function () {
$(".rotate").click(function () {
$(".masthead").transition({
perspective: '0',
rotateX: '90deg',
duration: 250
});
});
$(".rotate-back").click(function () {
$(".masthead").transition({
perspective: '0',
rotateX: '-90deg',
duration: 250
});
});
});
CSS
.masthead {
-webkit-animation-timing-function: ease-in-out;
-webkit-transform-style: preserve-3d;
-webkit-transform-origin: 22px 22px 0;
}
.masthead .face {
height: 44px;
position: absolute;
width: 100%;
}
.masthead .face-1 {
background: red;
-webkit-transform: translateZ(22px);
}
.masthead .face-2 {
background: aqua;
-webkit-transform: rotateX(-90deg) translateZ(22px);
}
Any help would be appreciated, thank you!