Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery to flip div 180 degrees

Tags:

jquery

Bascially trying to show a series of cards similar to playing cards or Tarot which each have a unique picture or image on one side and a text description on the other.

When page is loaded the image will show first off but on clicking a button the card will flip 180 degrees to show a text description of the card/image.

So therefore I guess it's a question of flipping the image in 3d while revealing the div behind. Looked at the Cycle plugin but not sure it is what is needed.

Anyone any ideas?

like image 965
alkaemia Avatar asked May 20 '11 09:05

alkaemia


1 Answers

Use CSS3 for the rotation:

  • In Mozilla Firefox this will be -moz-transform: rotate(180deg)
  • In Webkit based browsers, i.e. Chrome: -webkit-transform: rotate(180deg)
  • In Opera: -o-transform: rotate(180deg)
  • In IE: -ms-transform: rotate(180deg) (only IE9)
  • In pre-IE9: not easily possible, will need the use of Matrix Filter

Use jQuery rotate plugin to unify all the browser differences.

See fiddle: http://jsfiddle.net/garreh/bqYUA/

like image 168
Gary Green Avatar answered Nov 14 '22 00:11

Gary Green