Reputation: 95
What would be the best way for me to take something like this CSS Flip onhover, and make it apply the CSS transition / class onclick instead.
http://css3.bradshawenterprises.com/flip/
If someone could build a working example for me in jsfiddle, I would greatly appreciate it.
Upvotes: 0
Views: 3025
Reputation: 43810
you can create the css class that does the flip first. Then use javascript to assign it the the element in a click event.
CSS:
.flippingClass{
... flip ...
}
Javascript:
$("#flipper").click(function () {
$(this).addClass("flippingClass");
});
Upvotes: 2
Reputation: 114367
CSS does not have a CLICK event. You can use JavaScript to add a class on click, and have that CSS class perform the animation.
.flip {
transform: rotateY(180deg);
box-shadow: -5px 5px 5px #aaa;
}
Upvotes: 3