Title: Mobile Collapsing Nested Menu
Last modified: November 11, 2024

---

# Mobile Collapsing Nested Menu

 *  Resolved [marketingsog](https://wordpress.org/support/users/marketingsog/)
 * (@marketingsog)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/mobile-collapsing-nested-menu/)
 * Hello,
 * I used the tutorial [https://www.elegantthemes.com/blog/divi-resources/how-to-create-a-mobile-collapsing-nested-menu-with-divis-theme-builder](https://www.elegantthemes.com/blog/divi-resources/how-to-create-a-mobile-collapsing-nested-menu-with-divis-theme-builder)
   to customize the mobile menu.
 * Unfortunately, the code seems to be changed by autoptimize, so I can’t expand
   the menu by clicking on the +. But with the parameter ?ao_noptirocket=1 in the
   URL and on my staging (without caching) it works.
 * How can I prevent autooptimize from adapting the code?
 *     ```wp-block-code
       <style>.et_mobile_menu .first-level > a {background-color: transparent;position: relative;}.et_mobile_menu .first-level > a:after {font-family: 'ETmodules';content: '\4c';font-weight: normal;position: absolute;font-size: 16px;top: 13px;right: 10px;}.et_mobile_menu .first-level > .icon-switch:after{content: '\4d';}.second-level {display: none;}.reveal-items {display: block;}</style><script>(function($) {       function setup_collapsible_submenus() {     var FirstLevel = $('.et_mobile_menu .first-level > a');   FirstLevel.off('click').click(function() {$(this).attr('href', '#');  $(this).parent().children().children().toggleClass('reveal-items');$(this).toggleClass('icon-switch');});    }       $(window).load(function() {setTimeout(function() {setup_collapsible_submenus();}, 700);});  })(jQuery);</script>
       ```
   
 * Thanks a lot, Nico
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fmobile-collapsing-nested-menu%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/mobile-collapsing-nested-menu/#post-18127326)
 * First and foremost try to identify what is breaking the menu by just disabling
   CSS or JS or HTML or Image optimization (incl. lazyload). Based on that we can
   see what the next steps need to be 🙂
 * frank
 *  Thread Starter [marketingsog](https://wordpress.org/support/users/marketingsog/)
 * (@marketingsog)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/mobile-collapsing-nested-menu/#post-18128597)
 * Hi Frank,
 * Thanks, when I disable JS it works properly. How can I exclude this script from
   optimization? Thanks
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/mobile-collapsing-nested-menu/#post-18128617)
 * Can you try changing JS optimization settings, disabling “aggregate JS” and instead
   use “don’t aggregate but defer” and “also defer inline JS”?
 *  Thread Starter [marketingsog](https://wordpress.org/support/users/marketingsog/)
 * (@marketingsog)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/mobile-collapsing-nested-menu/#post-18128643)
 * It only works with JS optimization enable and the other disabled. But now the
   pagespeed is worse
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/mobile-collapsing-nested-menu/#post-18128685)
 * If I’m not mistaking you’ve re-enabled “aggregate JS”? I just tested in Chrome&
   FF on Android and in both cases the dropdown menu works?
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/mobile-collapsing-nested-menu/#post-18182559)
 * were you able to get things going [@marketingsog](https://wordpress.org/support/users/marketingsog/)?
 *  Thread Starter [marketingsog](https://wordpress.org/support/users/marketingsog/)
 * (@marketingsog)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/mobile-collapsing-nested-menu/#post-18182575)
 * Yes thank you, it helped with disabling aggregate JS

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Mobile Collapsing Nested Menu’ is closed to new replies.

 * ![](https://ps.w.org/autoptimize/assets/icon-256X256.png?rev=2211608)
 * [Autoptimize](https://wordpress.org/plugins/autoptimize/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/autoptimize/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/autoptimize/)
 * [Active Topics](https://wordpress.org/support/plugin/autoptimize/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/autoptimize/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/autoptimize/reviews/)

 * 7 replies
 * 2 participants
 * Last reply from: [marketingsog](https://wordpress.org/support/users/marketingsog/)
 * Last activity: [1 year, 6 months ago](https://wordpress.org/support/topic/mobile-collapsing-nested-menu/#post-18182575)
 * Status: resolved