Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
What to do when Ajax is faster than CSS
1 point by pwoods on Sept 2, 2008 | hide | past | favorite | 4 comments
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



The 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.


are you using $(document).ready() ?


Yes 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.


if 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.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: