The reason I am posting this question is because there is a fundamental issue with the menu system in the Divi theme by Elegant themes for Wordpress.
If you are using this theme, and you have a large menu, you may be running into issues. There are 2 issues to discuss here.
- If any menu or sub menu has enough items that it goes past the bottom of the screen, the user cannot see all the items, nor can the user scroll to see the items. (see 1st screenshot below)
- If any menu or sub menu goes off the right side of the screen, it get's cut off (or the user never sees it at all), and the user can't scroll to see the menu items (see 2nd screenshot below)
I've looked at the support portal for Elegant Themes and this is a known issue. When users run into it, Elegant Themes support seems to just suggest re-doing the menu so that it does not have so many items or the items do not go off the edge of the screen, or they give a css fix that doesn't work in all situations.
To me those solutions are not a fix, so, I came up with my own fix that works in all situations that I've tested it in. Suggestions are welcome and if someone else has a better fix, please post it.
(Screenshot 1)
(Screenshot 2)
The fix requires some javascript.
You can either add the javascript to a child theme using the
wp_enqueue_scripts
hook, or you can add the javascript directly to your theme options in the ePanel. (To add it to the ePanel, go to your ePanel and click on "Integration", and add the following code to the thehead
of your blog.The following code is heavily commented so that you coders out there can easily follow what's going on and how it works. If you find any issues with it, please let me know.