图片按顺序显示

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style>
img{
100px;
height:100px;
}
</style>
</head>

<body>
<div id="rili"></div>
<script src="jquery-1.9.1.min.js"></script>
<script type="text/javascript">
function loadImg(arr){
var imgurl=arr.shift();
if(imgurl && typeof imgurl!= 'undefined'){
var img=new Image();
img.src=imgurl;
img.onload=function(){
$("body").append(img)
setTimeout(function(){loadImg(arr)},1000)

}
}

}
loadImg(['timg.jpg','timg1.jpg','timg2.jpg','timg3.jpg','timg4.jpg','timg5.jpg','timg1.png','timg2.png'])
</script></body></html>
原文地址:https://www.cnblogs.com/liuhao-web/p/10265683.html