Skip to content

Instantly share code, notes, and snippets.

@desigens
Created October 17, 2015 10:51
Show Gist options
  • Save desigens/7c8048f390b2cb21471c to your computer and use it in GitHub Desktop.
Save desigens/7c8048f390b2cb21471c to your computer and use it in GitHub Desktop.
Async background image
<!DOCTYPE html>
<html>
<head>
<title></title>
<style type="text/css">
body.a {
background: url(http://ololo.com/i.png) no-repeat;
}
</style>
</head>
<body onload="end()" id="body">
<div id="a">null1</div>
<script type="text/javascript">
Date.now = Date.now || function() { return +new Date; };
var t = Date.now();
var out = document.getElementById('a')
// console.time(1);
function end () {
// console.timeEnd(1);
out.innerHTML = (Date.now() - t);
}
setTimeout(function () {
document.getElementById('body').className = 'a';
}, 0);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment