Hamburger Menu not Working (Combining and Deferring JS)

Hello,

I recently spent time to optimize my site by deferring Javascript and combining Javascript. I had really great results for performance but then when I went to use the mobile menu (hamburger) it would not open. Is there some JS that I need to exclude for this to work? Can you point me in the right direction?

-Joe

Hi Joe,

Please exclude the following files:

wp-content/themes/pro/cornerstone/assets/dist-app/js/cs-vendor.js
wp-content/themes/pro/cornerstone/assets/dist-app/js/cs.js
wp-content/themes/pro/cornerstone/assets/dist/js/site/cs-head.js
wp-content/themes/pro/cornerstone/assets/dist/js/site/cs-body.js
wp-content/themes/pro/cornerstone/assets/dist/js/admin/huebert.js
wp-content/themes/pro/framework/dist/js/site/x.js

Those files are already minified so there is no need for minifying it again.

Hope this helps.

Hello Lely,

Thank you so much for these excludes. It appears to have fixed the problem of the mobile menu opening upon clicking. I was concerned we would not be able to find a fix for this.

I did notice however a lot more errors and warning in the console upon loading. Please take a look at the picture below:

It appears that there are issues with Google analytics being run as well within woocommerce.

How do we precede?

Hello Joseph,

The mobile menu works on my end.

Since you have installed a caching plugin LiteSpeed Cache, please clear your plugin cache and regenerate the minified JS/CSS files before testing your site. This can cause the changes to not take place on the front end. It will eventually show up when the cache regenerates, but it’s not ideal if you’re looking to see your changes immediately.

You will also need to clear your browser cache or use private browsing mode and test your site again.

Hello RueNel,

I mentioned in my previous post that the mobile menu was now working great! I am most grateful!

I was hoping to get you help why I am seeing so many errors in the inspector console now. Feel free to check it yourself or reference the screenshots I shared. Thank you!

-Joe

Hi Joe,

As stated by Ruenel, it might be because cache is still needs to regenerate. I’ve check again and the errors are gone: https://screencast-o-matic.com/watch/cqjU2Rt3p7

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.