so I am loading a new page and a css file for this page via ajax.
After all the css files are added to the page, I set the opacity of the page to 1, but it shows up without the css applied and after a second or so the css is applied. This looks horrible, how can I avoid it?
I did not find a clean way to detect when css fully loaded.
Any idea why it shows up like this? I think the css might not be fully downloaded yet, but as I said, I do not know how to avoid that.
There is AFAIK no bullet-proof way of checking when a CSS file is loaded and styles have applied without using a “layout” element, then listen for it.
F.ex in your CSS file:
Then in your javascript (I use jQuery here):