I am trying to combine rotationY and translateZ in a website, but it seems translateZ cancels the rotation.
I created a codepen isolating my problem:http://codepen.io/3MO/pen/zNadrB
When I click on show Left, the box is showing its left side by adding a specific class 'show-left'. Then I click on push back, the box is pushed to the back by adding the 'push-back' class. The front side is rotated back, while the classes of the div are now 'show-left push-back'.
The css and javascript are quite basic:
.show-left {
transform: rotateY(90deg);
}
.push-back {
transform: translateZ(-1000px);
}
On the javascript side :
window.onload = function () {
$('#showLeft').on('click', function (event) {
$('#mainBox').addClass('show-left');
});
$('#pushBack').on('click', function (event) {
$('#mainBox').addClass('push-back');
});
}
What do I do wrong ? Thanks!