Skip to content

Instantly share code, notes, and snippets.

@tomyhero
Created February 29, 2016 02:56
Show Gist options
  • Save tomyhero/07740cddb2964e54a3ab to your computer and use it in GitHub Desktop.
Save tomyhero/07740cddb2964e54a3ab to your computer and use it in GitHub Desktop.
check image load timing
<html>
<head>
<title>test</title>
</head>
<body>
<img src="http://blog-imgs-19.fc2.com/r/i/s/risuco/20090509_003.jpg" onload="console.log('loaded 1')">
<img src="https://upload.wikimedia.org/wikipedia/ja/archive/4/4b/20100914121956!Wiki-ezorisu3.jpg" onload="console.log('loaded 2')">
<img src="http://inuneko-sp.gsj.bz/images/special/risubon/02_004_MG_3434.jpg" onload="console.log('loaded 3')">
<img src="http://www.pref-nagano-hosp.jp/kiso/wp-content/uploads/d7d3388f23579594a4d7ef7aaf0a69e8.jpg" onload="console.log('loaded 4')">
<img src="http://gazou.kizitora.jp/wp-content/uploads/2015/09/12234_1920x1080_FullHD_wallpaper.jpg" onload="console.log('loaded 5')">
<script src="http://code.jquery.com/jquery-1.12.0.min.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<script>
$(function() {
$("img").each(function(e,v) {
v.onload = function() {
console.log("loaded:" + v.src );
}
})
});
$(window).load(function () {
console.log("all loaded");
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment