Created
March 4, 2014 00:11
-
-
Save z-------------/9337510 to your computer and use it in GitHub Desktop.
JS + CSS fade effect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style> | |
body { | |
opacity:0; /* invisible at first */ | |
transition:opacity 1s; /* transition opacity for 1 second */ | |
} | |
</style> | |
<script> | |
document.addEventListener("DOMContentLoaded",function(){ // equivalent to jQuery ready() | |
document.body.style.opacity = "1"; // set body's opacity to 1 | |
}) | |
/* this method is much better than using jQuery since you don't have to load a huge library | |
* to do a simple effect like a fade | |
* pls use it */ | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment