Last active
December 11, 2015 11:48
-
-
Save codepunkt/4596410 to your computer and use it in GitHub Desktop.
Delay DOMContentLoaded. NodeJS server using connect to deliver 25s delayed css.
This file contains hidden or 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
<!doctype html5> | |
<html> | |
<head> | |
<style> | |
#box { height: 250px; -webkit-transition: all 5s; -moz-transition: all 5s; } | |
</style> | |
<script> | |
window.addEventListener('DOMContentLoaded', function() { | |
console.log('DOMContentLoaded!'); | |
}, false); | |
window.setTimeout(function() { | |
console.log('Changing color...'); | |
document.getElementById('box').style.backgroundColor = '#bada55'; | |
}, 5000); | |
</script> | |
</head> | |
<body> | |
<div id="box"></div> | |
<link rel="stylesheet" type="text/css" href="http://localhost:8080/delay25s.css"/> | |
<script src="whatever.js"></script> | |
</body> | |
</html> |
This file contains hidden or 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
require('connect')().use(function(req, res) { | |
setTimeout(function() { | |
res.end('body { background: #eee; }'); | |
}, 25000); } | |
).listen(8080); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment