Site logo

Archived topic

Menu beyond the width

7 replies · Started by Ogi22 on November 1, 2018

Viewing posts 1–8 of 8

Thank you for your response.

I looked at the solution.

In that case (GeneratePress 2.2 update) , however, a same fault occurs on the opposite side.

It would be good for the menu opening direction, at all levels, to change automatically, depending on whether it opens out of range.

That would involve some pretty considerable JS which would likely hurt performance a bit.

In most cases, this shouldn't be an issue unless you're testing it on a very small screen, or your sub-menus are very long/have a lot of levels.

JS is not the right way.
Rather some CSS or PHP.

What to try to use CSS "@media only screen"
and (max-width: px) and (min-width: px)
{

In some way, load the screen width of the browser while loading.
And to capture the change of this width that is going on if the menu opens out of range?

And if the width changes, change the direction of opening the menu?
If the width returns to its original value, the direction of the opening will return.

(I do not know how.
I'm not at that level yet.)

And to capture the change of this width that is going on if the menu opens out of range?

That's the part that requires javascript.

Unfortunately, there isn't an easy way to do this automatically without javascript.

Yep, that's a good jQuery solution. GP itself doesn't load the jQuery library, so it wouldn't be a viable solution for the core theme.

It also requires attaching a JS event to the hover dropdown, which we try to avoid. As of right now, the sub-menus are 100% CSS.

Of course, you could apply a solution like that to your site without it needing to be in the theme.

This archived topic is closed to new replies.