by timw4mail · 7y ago · 0 comments
Google also uses this trick in search results if I remember correctly.
This is a bad technique. If you really want that effect, something friendlier would be this in the head of the document:
<script>document.documentElement.className+=' js'</script>
… then prefix that earlier selector with `.js`.Or another approach: remove the `opacity: 0` from the stylesheet, and immediately inside the element to be hidden while loading, add
<script>document.currentScript.parentNode.style.opacity=0</script>
Remember that external JS is never guaranteed to load; even on normal people’s computers, networks are not reliable and even first-party resources can fail to load, though it’s ones on a different origin that are the least reliable.