I am attempting to create a visually appealing CSS menu using primarily CSS, with just a touch of jQuery as well:
Here is the concept:
+------------------------+
| |
| |
| +---+ |
| | | |
| |___| | <-- Hover over this central piece
| |
| |
| |
+------------------------+
+------------------------+
| _ |
| |\ | <-- All elements move towards the top of the screen
| \ +---+ |
| | | |
| |___| |
| |
| |
| |
+------------------------+
...and so on...
The plan involves four div children, each positioned at 90-degree intervals from the center. However, I am trying to figure out a way to determine the angle/position in jQuery, which has proven to be challenging.
Similar design:
If there were six child divs, they would be evenly spaced out at 60-degree intervals.
I will also be incorporating animations between them, leading me to experiment with rotations, but I have not been successful:
My questions are:
(A): How can I rotate the divs by a specified angle or distance relative to their parent using jQuery?
(B): How can I reset the animation upon hover out?
Other similar implementations:
- Here
- This one, although it utilizes Sass (which is not desired)