<p>Click on the image to see the transition on the transform property.</p>
<div class="container">
<img id="image" src="http://tympanus.net/codrops-playground/assets/images/cssref/properties/transform/transform-cat.jpg" alt="Image of a kitten.">
</div>
body {
background-color: #F5F5F5;
color: #555;
font-size: 1.1em;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
.container {
margin: 10px auto;
max-width: 700px;
}
img {
-webkit-transition: -webkit-transform 1s;
transition: -webkit-transform 1s;
transition: transform 1s;
box-shadow: 0 0 10px 5px rgba(0, 0, 0, 0.2);
max-width: 100%;
}
img:hover {
cursor: pointer;
}
.transform {
-webkit-transition: -webkit-transform 1s;
transition: transform 1s;
-webkit-transform: perspective(800px) rotateX(-90deg) translateZ(300px);
transform: perspective(800px) rotateX(-90deg) translateZ(300px);
}
var img = document.getElementById("image");
var transformed = false;
img.onclick = function(){
if(transformed == false) {
this.classList.add('transform');
transformed = true;
}
else {
this.classList.remove('transform');
transformed = false;
}
}