0

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.

2
  • 1
    "If someone could build it for me..". We aren't free-of-charge rent-a-coders. But we do help with programming problems. What exactly have you tried? Got any code? Commented Dec 5, 2012 at 19:00
  • You're correct! I'll note to post my js fiddle files in future posts. Best not to use the comment section for personal crusades so I've removed any posts that don't involve the question. Commented Dec 5, 2012 at 19:45

2 Answers 2

3

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;
}
Sign up to request clarification or add additional context in comments.

3 Comments

Would I be able to tempt u to throw an example into a fiddle? I should've specified that I was looking for a js example with the onclick. Thanks!
Combine this with Ibu's answer and you've got it.
Finally working, thanks! I couldn't figure out how to swap the background image for the front once the class was added, but that's fixed now.
2

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");
});

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.