效果如下:


代码如下:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<style type = "text/css">
ul, li { padding: 0; margin: 0; }
li { list-style: none; }
.box {
width: 800px;
height: 450px;
margin: 50px auto;
overflow: hidden;
position: relative;
}
.box span {
width: 40px;
height: 60px;
display: block;
position: absolute;
top: 225px;
margin-top: -20px;
cursor: pointer;
z-index: 1;
}
.box #left {
background: url('/upload/otherpic37/042311cbd7gbjd7sggkd2b.png') no-repeat;
left: 0;
}
.box #right {
background: url('/upload/otherpic37/042241w8z4hx4m4pjhyjzs.png') no-repeat;
right: 0;
}
#ad {
width: 4000px;
height: 450px;
position: absolute;
}
#ad li {
float: left;
}
</style>
<script type = "text/javascript">
window.onload = function(){
var ad = document.getElementById("ad");
var timer = null;//管理定时器
var leader = 0;
//1秒之后再开启定时器
timer = setTimeout(function(){
timer = setInterval(autoAd,30);
},1000);
//开启定时器
function autoAd(){
leader -=5;
leader<=-3200?leader = 0:leader;
ad.style.left = leader +"px";
}
//鼠标划入 关闭定时器
ad.onmouseover = function() {
clearInterval(timer);
}
//鼠标离开 开启定时器
ad.onmouseout = function(){
timer = setInterval(autoAd,20);
}
}
</script>
</head>
<body>
<div class="box">
<ul id="ad">
<li><img src="/upload/otherpic37/042153lscsitwp7sszb6zs.jpg" alt=""></li>
<li><img src="/upload/otherpic37/042152pfbkbfe8vbtvulfu.jpg" alt=""></li>
<li><img src="/upload/otherpic37/042153u3jgn0ds43ndd3dz.jpg" alt=""></li>
<li><img src="/upload/otherpic37/042152juuohne22z60hbsb.jpg" alt=""></li>
<li><img src="/upload/otherpic37/042153lscsitwp7sszb6zs.jpg" alt=""></li>
</ul>
<span id="left"></span>
<span id="right"></span>
</div>
</body>
</html>另外有需要云服务器可以了解下创新互联建站www.cdcxhl.com,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。