Skip to content

Instantly share code, notes, and snippets.

@bulbul84
Created August 11, 2015 05:57
Show Gist options
  • Save bulbul84/37710a80e8985d2057f9 to your computer and use it in GitHub Desktop.
Save bulbul84/37710a80e8985d2057f9 to your computer and use it in GitHub Desktop.
// Example One
<script>
setTimeout(function() {
document.body.style.background = 'red';
}, 3000);
window.onload = function() {
document.body.style.background = 'green';
};
</script>
// Example Two
$(document).ready(function () {
$('#btnFade').bind('click', function () {
FadeOut();
});
function FadeOut() {
setTimeout(function () { FadeDiv(); }, 2000);
}
function FadeDiv() {
$('#dvData').fadeOut();
}
});
// Example Three
<!DOCTYPE html>
<meta charset="utf-8">
<title>setTimeout() and window.onload</title>
<img src="image.png">
<script>
setTimeout(function() {
document.body.style.background = 'red';
}, 3000);
window.onload = function() {
document.body.style.background = 'green';
};
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment