jquery 写的图片左右连续滚动

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="zh-CN">

<head profile="http://gmpg.org/xfn/11">

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<title>

网络蛀虫小窝

兼容ie的滚动图片jquery代码</title>

<style type="text/css">
*{ margin:0; padding:0;}
body { font:12px/1.8 Arial; color:#666;}
h1.tit-h1 { font-size:38px; text-align:center; margin:30px 0 15px; color:#f60;}
.go-back{ text-align:center; border-top:1px dashed #ccc; padding:10px; margin-top:20px; font-size:40px;}
.wrap{border:1px dashed #ccc; background:#f8f8f8; padding:20px;}
#slide{overflow:hidden;width:900px;margin:100px auto;}
ul{list-style:none;} li{float:left;} .slideul1{width:3999px;}
</style>
<script type="text/javascript" src="jquery.js"></script>
<body>
<h1 class="tit-h1">jquery图片左右连续滚动</h1>
<div class="wrap">
<div id="slide">
<ul class="slideul1">
<li class="slideli1">
<ul class="slideul2">
<li><a href="http://www.onbno.com/archives/2272.html"><img src="images/1.jpg"/></a></li>
<li>
<a href="http://www.onbno.com/archives/2272.html"><img src="images/2.jpg"/></a>
</li>
<li>
<a href="http://www.onbno.com/archives/2272.html"><img src="images/3.jpg"/></a>
</li>
<li>
<a href="http://www.onbno.com/archives/2272.html"><img src="images/4.jpg"/></a>
</li>
<li>
<a href="http://www.onbno.com/archives/2272.html"><img src="images/5.jpg"/></a>
</li>
</ul> <li class="slideli2"></li> </ul>
</div>
<script type="text/javascript">
var _speed=30; 
var _slide = $("#slide"); 
var _slideli1 = $(".slideli1");
 var _slideli2 = $(".slideli2"); 
 _slideli2.html(_slideli1.html()); 
 function Marquee(){ 
 if(_slide.scrollLeft() >= _slideli1.width())
 _slide.scrollLeft(0); 
 else{
 _slide.scrollLeft(_slide.scrollLeft()+1); 
 } }
 $(function(){ 
 //两秒后调用 
 var sliding=setInterval(Marquee,_speed)
 _slide.hover(function() { 
 //鼠标移动DIV上停止 
 clearInterval(sliding); 
 },
 function(){
 //离开继续调用 
 sliding=setInterval(Marquee,_speed);
 }); 
 });
 </script> 
 </div>
 » 本站地址:http://www.gomoth.com

标签: ,