As I remember display: none doesn't place an element in the DOM. So, it means that all of your properties are absent. I don't remember exactly how display works and may be wrong, but anyway the bug in this property And I think maybe it might be enough for you just use the .show() and .hide() methods from jq
I left it without animations, it's not very important to me. I can’t remove display none because This is a basic property of the overlay, it only appears when the menu is open.
You don't need to remove the display, but you need to change it to a different property(ies) for hiding an element. A few things that came to mind: opacity + pointer-events (what do you already have) top/left/right/bottom scale() Or set the initial state via jq, if its animation is good for you: overlay.hide(0) menu.eventListener(toggle) function toggle() { if (isOpen) overlay.hide(400) else overlay.show(400) } If you want to return to your problem in the future
Обсуждают сегодня