Link Search Menu Expand Document

Caching & Optimization

Mortar Menu has been developed with performance in mind. Everything is well optimized.

There’s one issue you might have when using Mortar Menu with a caching plugin. In this document, we use WP-Rocket as an example.

Table of Content

  1. 1. Toggle Button not working (Double clicks issue)

1. Toggle Button not working (Double clicks issue)

You may read a detailed article explaining the root cause and solutions here. We use Elementor for demonstration there but it’s the same for Bricks.

Basically, this happens when you enabled “Delay JavaScript execution”. And while being delayed, there’s no script to handle the very first user interaction.

WP-Rocket - delay javascript execution

To fix the issue:

First, copy and paste the following script into your theme footer (before the closing </body> tag).

<script id="timingDelayExecution">
// 500 milliseconds after a page loaded, trigger a fake user interaction.
window.onload = () => setTimeout(() => window.dispatchEvent(new Event('touchend')), 500);
</script>

Then, exclude the timingDelayExecution script from Delay JavaScript Execution:

WP-Rocket - excluded timingDelayExecution script

That’s it!


Last modified: Aug 25 2024 at 11:12 AM.