Abstracted from the random client logo flip display at http://theauditor.com.
We have 5 cards (blue on the front, red on the back for explanatory purposes). The first card has content item "1" on the front and "2" on the back, etc, until we reach the 5th and final card. A card has a back by having its two child divs positioned absolutely to be one on top of the other and having the second of these rotated 180deg. Conversely a flipped card has its first child div rotated 180deg and its second rotated 0deg.
We have a #pile of any number of more divs (probably not to be displayed in production) here containing items "11" to "20".
A randomly-selected card gets flipped by the jQuery toggling its flipped class.
If the randomly-selected card just acquired the flipped class, then its second child is displayed instead of its first child.
Conversely, if the randomly-selected card just lost its flipped class, then its first item is removed and added to the pile; a pile item that's already been randomly selected is appended to the card; and the new first child shows.
However! The newly unflipped card's first child is its former second child, so we get the same content again. Therefore we set the non-flipped transition time to 0.
So the actual visible flip only happens to cards that are not flipped. If a card is already flipped, flipping it merely feeds it with new content and sets it to be usefully flippable next time it's selected. Awkward, but I can't see how else this can work.