首页javascriptimgjQuery HTML Element - 如何句柄图像加载事件

jQuery HTML Element - 如何句柄图像加载事件

我们想知道如何句柄图像加载事件。

<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
  src='http://code.jquery.com/jquery-2.0.2.js'></script>
<script type='text/javascript'>
$(function(){
    console.log("hey");
    $('#foo').load(function(e) {
        console.log("loaded");
        console.log(e);
    });
});
</script>
</head>
<body>
  <img id="foo" src="http://www.w3cschool.cn/style/download.png" />
</body>
</html>