<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="jquery-2.1.4.min.js"></script>
</head>
<body>
<img id="image" src="img/1.jpg" style="width:321px;height: 463px;" onmouseleave="start()" onmouseenter="end()">
<script>
function start() {
var img_list =["img/1.jpg","img/2.jpg","img/3.jpg","img/4.jpg"];
var i = 0;
interval = setInterval(
function () {
if(i>2){
i=0;
}else{
i++;
}
img = img_list[i];
$("#image").attr("src",img)
},
1000
);
}
function end() {
clearInterval(interval);
}
</script>
</body>
</html>
BANNER
最新推荐文章于 2022-06-29 16:51:44 发布