Back to Snippets

Sliding Glassmorphism Dropdown Menu JS

A dropdown that holds more than one level. Clicking a product slides the panel across to its submenu, and the back link slides it home again.

Both panels sit side by side in a row twice the width of the dropdown, each taking half of it, inside a container with overflow hidden. Sliding is one translateX of minus 50 percent on that row rather than showing and hiding panels, so the two views move as a single piece and nothing reflows partway through.

Closing waits 300 milliseconds before resetting to the first panel, which lets the fade out finish before the slide snaps back. Without that delay you watch the menu rewind itself on the way out. Adding a third level means one more panel in the row and a wider container to match.

210
#javascript
#css
#dropdown
#menu
#glassmorphism
#slider
#navigation
#modern ui
#saas