Reducing the number of DOM by optimizing the menu widget in Elementor #27583
socialreza
started this conversation in
Feature Request
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Prerequisites
What problem is your feature request going to solve? Please describe..
I want to reduce the number of DOM in the HTML output, which will increase the speed of the website. Inside the menu widget settings in Elementor, whether the mobile drop-down menu is active or not, in both modes, a separate menu for mobile is placed in the HTML output, which is hidden using CSS in desktop mode, there are 2 menus, one for desktop and the other For mobile, HTML output increases the number of DOM and slows down the website.
Describe the solution you'd like.
I noticed that all the desktop and mobile menu codes are the same, except for the NAV tag class :
You can use a menu and change the NAV tag class values based on the screen size using JavaScript.
For example, in desktop mode, if it was inside the NAV tag class, it should be elementor-nav-menu--main elementor-nav-menu__container elementor-nav-menu--layout-horizontal e--pointer-none. And if it was in mobile mode, elementor-nav-menu--dropdown elementor-nav-menu__container should be placed inside the NAV tag class.
Describe alternatives you've considered.
No response
Additional context
No response
Agreement
All reactions