How can you "hide" something with CSS?
I created a context menu that also has submenus:
https://jsbin.com/vaxayibeme/1/edit?html,css,output
For user-friendliness, the submenus should be shown and hidden with a fade animation, so that if you have been out of it for a few milliseconds, you can go back in with the mouse to keep it open.
When you are in this area with the mouse:
However, the two submenus Above / Below open immediately. This is especially problematic on a mobile phone, because you only navigate with clicks. It's easy to accidentally insert something when you just wanted to close the menu (or change the type and potentially delete data).
I've hidden the inactive entries with opacity: 0 (because you can animate them with transition to create that fade effect). However, this has the disadvantage that they're only "invisible" but still clickable.
Before, I had hidden it with display: none so that it was really gone, but you can't animate it, which makes it less user-friendly.
Does anyone have an idea how to hide the submenus using CSS? (It doesn't necessarily have to be a fade effect, just a way to prevent them from being opened accidentally, so you can hover your mouse over the area shown in image 2 without it opening).
I'll add code for everyone who doesn't want to go to JS Bin (otherwise it would be too long).
HTML:
CSS: