I'm encountering difficulties making direction-aware hover and css transitions function correctly. Specifically, I am attempting to create a grid of elements with front and back faces, and on hover, have a css transition that flips the element to display the back face.
Here's an example of the transition (without direction-aware): fiddle
Currently, no matter how your mouse enters an element, it always flips up. My goal is to have it flip in the direction the mouse enters or exits.
Examples:
https://i.sstatic.net/Fm9Qf.gif https://i.sstatic.net/MJIkn.gif
Below is my attempt at implementing direction-aware: fiddle
I am using jQuery to add classes related to the mouse's direction in/out.
.hover-in-top {}
.hover-in-right {}
.hover-in-bottom {}
.hover-in-left {}
.hover-out-top {}
.hover-out-right {}
.hover-out-bottom {}
.hover-out-left {}
While the direction-aware example somewhat works, there are significant glitches that I can't seem to figure out. (I've been overthinking this and my brain feels overloaded.)
I hope this explanation makes sense. Thank you.