Description
An easy to implement technique for fading in a page with CSS & JavaScript, useful for pages that have a slight delay when loading.
Summary
- When I visit a page, I get annoyed when I try to interact with elements while the website is still loading.
- This means I have to set the opacity using JavaScript.
- If I wait for this to happen in my external JavaScript, then it’s not going to happen quickly enough.
- I’m also running some useless JavaScript (adding a bunch of classes to the HTML) just to pretend something’s happening to give the appearance of a pause before the fade-in happens.