4 ms·
What to do when Ajax is faster than CSS
I have a jQuery enabled application that is running too fast for the Stylesheet to load. I can't figure out how to have the javascript run when the styles are all done.
Here is my page order
HTML
HEAD
JAVASCRIPT
CSS - One file with includes
TEXT
FOOTER
Any suggestions? I can reorder it but I'd like a clean solution maybe with something to do with the browser.
Paul
- shutter 18y agoThe CSS should go in the head, and the Javascript can be placed at the very end of the page right before the closing body tag. Failing that, you can put the JS right below the CSS in the head tag.
- noodle 18y agoare you using $(document).ready() ?
- pwoods 18y agoYes I am using the Document ready. It may not be that the CSS is loading slow but I have my doubts when I refresh and it operates the same.
- noodle 18y agoif this is what is in question, put the CSS inline instead of linking it in order to help debug. if things work peachy when doing this, then your problem lies in the importing of the css file. css first, before the js. if things are still broken, its your code.