I’m brand spankin’ new to Javascript. Here’s what I want to do. I want an array of square tiles covering the window and I want them to flip over when the mouse goes over them. I already have a single tile. See the Jsfiddle below.
I would like it so that the tile will flip over completely to the back side, even if the user doesn’t hover for the entire animation length (basically, even if the hover is only very brief, I want it to commit to rotating). I want it to hold its flipped state for some minimum amount time and then return if the user is no longer hovering.
Should I be trying to do this entirely in javascript or still using a lot of CSS?
You don’t need JavaScript/jQuery at all. Replace all
.flipreferences in your CSS by:hover: http://jsfiddle.net/V7cS8/1/For delays, you can use
transition-delay: 1s.Apply
transition-delay:1s;(delay 1 second, with vendor prefixes) to the normal selector, andtransition-delay:0sto the:hoverselector. The result is that the backflip will be delayed for 1 second.Demo: http://jsfiddle.net/s9xcP/2/
Outcome of comment chain: When existing animations have to be completed first, regardless of the hover state, a JavaScript timeout have to be used:
Demo: http://jsfiddle.net/nY8U8/224/