Using DEV OnmouseClick to open and close box.

I saw this video and thought I wanted to use that for a menu. But instead of hover mouse I would like to use ClickMouse to open the box. That works, but can I assign mouse click to close it again ? That I can’t figure out.
The video is this one.

Hope you can help me here.
All the best
Jess Pedersen

@andriis wrote a very useful wrapper you can use to change and delete any element’s click function completely:
https://www.wix.com/corvid/forum/community-discussion/remove-or-replace-event-listeners