4 ms·
It is good advice, but not optimal. If you want to go for ultra-fast page loads then you're putting the jQuery JS file at the bottom of your page. If you do tha
by untog 15y ago
It is good advice, but not optimal. If you want to go for ultra-fast page loads then you're putting the jQuery JS file at the bottom of your page. If you do that, the user will see an ugly flicker when content appears and disappears.
The solution is to just not use jQuery for that. It's such a simple operation anyway. I do something like:
<body>
<script type="text/javascript">
document.body.setAttribute("class","hasJs");
</script>
No flicker or jQuery load delay.
- ricardobeat 15y ago<script>document.getElementsByTagName('html')[0].className += ' js'</script> here, in <head>. Can co-exist with conditional IE classes a là HTML5 Boilerplate.