Hi Chris,
thanks so much for the prompt reply!
I’ve been looking at the situation some more, and found the inline code causing the delay:
if (jQuery.tabs) {
tagGroupsTabstaggroupscloudtabs5f5155ab7ab43();
} else {
setTimeout(tagGroupsTabstaggroupscloudtabs5f5155ab7ab43, 2000);
}
// here no jQuery(document).ready() because event listener might be bound too late
jQuery("#tag-groups-cloud-tabs-5f5155ab7ab43").bind("tabscreate", function(event, ui) {
setTimeout(function() {
jQuery(event.target).removeClass('tag-groups-cloud-hidden');
}, 500);
});
jQuery.tabs is not defined yet, as all the four (!) jQuery UI files needed are being loaded, as is normally correct, at end of body, no doubt properly enqueued. I’m using W3TC, but I don’t see any settings to move particular scripts to the head (nor in Clearfy). But nor do I find that an attractive idea, we all know what PageSpeed Insights will say )-:
What gets me shaking my head is, that having set W3TC up quite meticulously my site is blazing fast, scores 99/100 with PageSpeed Insights. But it’s not able to show the tag cloud for a good two seconds after the page is fully loaded, although all the page’s files are coming out of the browser cache.
I see your comment about event listeners possibly being bound too late. So how about options:
- To offer the option in the backend to try using document.ready() – maybe it works in many contexts…
- Failing that, to specify the milliseconds for the timeout
I’m sure you’re fitter in JS and WP than me, so sorry if my ideas are a bit too simple.
A last question: Is the basic HTML for the tabs complete in the page as coming from the server, or is JS actually extending the HTML? If the former is the case, I could extract the JS actually being used for the tabs and inline it or link it in the head. Theoretically might I even be able to reuse code already present say from Shortcodes Ultimate? I’m asking this because I’m a radical minimalist by nature and hate loading huge libraries and stylesheets, only say 10% of which will ever be used by my website. Reduce to the max is my motto ??
Again, many thanks!
Tim