Home Forums WoodMart support forum Website’s mobile menu takes time to load

Website’s mobile menu takes time to load

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #686829

    admin-3814
    Participant

    We are currently using the Woodmart theme along with the WP Rocket plugin on our website.
    I have enabled both the “Delay JavaScript Execution” and “Defer JavaScript” options in WP Rocket. Additionally, in the theme settings, I’ve activated the “WP Rocket Delay JS Exclusions” option to get an exclusion list for the theme.
    However, we’re experiencing an issue with the mobile menu. When a user clicks the menu icon immediately after the page loads—without interacting with the page (e.g., scrolling)—the menu takes time to appear. But, if the user interacts with the page first and click on the menu icon, the menu opens much faster.

    Upon investigation, I found that the function responsible for triggering the mobile menu is loaded only after all delayed scripts have loaded.

    Could you please review this and suggest a solution to fix the mobile menu loading delay?

    #686836

    Artem Temos
    Keymaster

    Hello

    This behavior is expected due to the “Delay JavaScript Execution” feature in WP Rocket. This option postpones loading certain JavaScript files until the user interacts with the page, such as scrolling or clicking. As a result, when the mobile menu icon is clicked immediately after page load without prior interaction, all scripts are loading, causing the delay.

    Regards

    #686838

    admin-3814
    Participant

    We cannot disable the “Delay JavaScript Execution” as it will affect the website’s performance. Is there any solution to fix the delay? Or could you please specify which scripts should be excluded from the “Delay JavaScript Execution” to ensure the menu functions correctly without any delay?

    #686856

    Artem Temos
    Keymaster

    Hello,

    The actual lag is caused by the “delay option” itself. When you click on anything on your page, it begins loading all the scripts simultaneously. This is why you experience this lag. In essence, you intentionally create this lag by enabling the “Delay JS” option. While this option improves the initial loading time (since scripts aren’t loaded), it also adds some waiting time on the first click. Excluding scripts doesn’t make any difference because there are still a lot of files to load. You need to decide whether you load all the scripts initially or you enable Delayed JS.

    Kind Regards

Viewing 4 posts - 1 through 4 (of 4 total)