Javascript is not active before the content loads

Helly guys

I wonder one thing: I have an off canvas element with an attribute aria-hidden=“false”, which loads the element “open” and a the toggle “closes” the element on click.

This js works only after the content, at least the looper in a lower div is loaded. Is there a way how to make the script listening before the content of the page is loads?

The site in question is in the secure message, NDA… sh…

There is no other custom javascript for the page nor global there.

EDIT: ok, I figured out, that the caching plugin is the troublemaker. What JS do I need to exclude from caching?
EDIT 2: According to the plugin author, who checked the settings, the caching plugin is not the cause. Duh. The delay is still present even the caching is off on his side.

Hello Ondrej,

Thanks for writing in! By default, the CSS is added at the head of the page while the Javascripts are added at the bottom of the HTMLpage. Be advised that all page resources including the Javascript must be loaded first before it can be applied to the page elements. There should be a slight delay specially if the page size is slightly bigger file size.

  • See the secure note below

Best Regards.

Hello. Yeah. It’s almost gone. I don’t understand. The point is, the client is clicking the “close” button and it does not work right of the bat, but until the page is rendered. It’s fast here. It’s a horror at the clients side.

And I can’t reproduce it. The page is not huge, it’s actually very OK in respect to the size (kBs) of the content. I guess I’ll have to have a glas of wine with the client and chill a bit.

Thank you for the update. You may need to preload the scripts, specifically the ones in the pro/cornerstone/assets/js/site and pro/framework/dist folders (x.js, cs-classic.7.6.10.js). We noticed that preloading of scripts has already been done, but all scripts are currently being preloaded without any prioritization or exclusion. This approach doesn’t provide much benefit in this case, since the scripts are still loaded as-is.

These links may help:

https://perfmatters.io/docs/preload
https://jetpack.com/resources/wordpress-preload-key-requests

Best regards,

Hi Ismael
I utilize the seraphinite accelerator for caching and speed enhancements. I’ll have to check, if there’s any option regarding the javascript handling in respect to prioritization.

Could you pls tell me, which of the scripts should be addressed? I guess you’re much faster than me in “finding out”.

Thx a heap for the info.
Cheers

Hey Ondrej,

The scripts in our themes will always change so it’s best to include all JS in any theme or plugin. Most optimization plugins have the feature. You’ll just need to ask the plugin support or refer to their documentation.

If you need optimization recommendations, please consider getting our Boost service. You can learn more here https://theme.co/boost

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