Hey there. So I need some help writing a single snippet of code. My website currently has a menu that is stretched the full length of the page, but adjusted to the right. So when as make the browser window smaller, the menu moves towards the left of the header. Currently, if you do this, the header does not collapse, and instead reaches a point where it overlaps an image on the header and gets cut off if the window is small enough.
All I want is to detect when the browser window is at a certain length, and if it is at that length, to then collapse my menu into a hamburger menu on the header, similar to mobile. I’ve seen a couple posts about it, but nobody detailing specifically how to do this.
The only piece I know so far is
getBoundingRect( )
From what I know it can be used to detect the size of a window. But then what? Would I be able to use
collapse( ) on the horizontal menu and expand( ) on the hamburger menu? If so, I know nothing about code, so I’m not sure how to even write it.
Any help is much appreciated!