日期:2014-05-16  浏览次数:20389 次

有个用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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link href="css/all.css" rel="stylesheet" type="text/css" />
<SCRIPT type=text/javascript src="js/swfobject.js"></SCRIPT>
<SCRIPT type=text/javascript src="js/jquery-1.4.4.min.js"></SCRIPT>
<!--[if IE 6]>
<script type="text/javascript" src="js/DD_belatedPNG.js" ></script>
<script type="text/javascript">
DD_belatedPNG.fix('.logo,.tools a,.xiaozhangjiyu,.tongzhigonggao,.xuexiaokuaixun,.menu_left');
</script>
  <![endif]-->
<script type="text/javascript">

$(function(){
var demo = $(".tpgd");
var demo1 = $(".tpgd ul");
var Ulwidth =0;
  $(".tpgd ul li").each(function(){
  Ulwidth += $(this).outerWidth("true");
  });
  demo1.width(Ulwidth);
  alert(demo1.width());
  var Marquee = function(){
if(demo.scrollLeft()>=1192){
alert("scrollLeft ==== >" +demo.scrollLeft());
demo.scrollLeft(0);
}else{
  demo.scrollLeft(demo.scrollLeft()+1);
   
}
 
}
setInterval(Marquee,10);
})
</script>
</head>
<body>
<div class="shetuan">
  <div class="dcst"></div>
<div class="tpgd">
  <ul>
  <li><a href="#"><img src="images/pc.jpg" width="169" height="129" /></a><span>创建学习型学校先进单位</span></li>
  <li><a href="#"><img src="images/pc1.jpg" width="169" height="129" /></a><span>创建学习型学校先进单位</span></li>
  <li><a href="#"><img src="images/pc.jpg" width="169" height="129" /></a><span>创建学习型学校先进单位</span></li>
  <li><a href="#"><img src="images/pc1.jpg" width="169" height="129" /></a><span>创建学习型学校先进单位</span></li>
  <li><a href="#"><img src="images/pc.jpg" width="169" height="129" /></a><span>创建学习型学校先进单位</span></li>

  </ul>
</div>
  </div>
</body>
</html>





这个是css样式
.shetuan{position:absolute; width:900px; margin:40px auto 10px 20px; clear:both; max-height:196px; background:#f5ffec; border:#cbdf92 solid 1px;}
.tpgd{overflow:hidden; width:900px;clear:both; max-height:196px; background:#f5ffec; border:#cbdf92 solid 1px;}
.shetuan .dcst,.shetuan .sgll{ position:absolute; top:-28px; left:391px; width:222px; height:46px; background:url(../images/dcst.jpg) no-repeat; }
.shetuan .sgll{background:url(../images/sgll.jpg) no-repeat; }
.tpgd ul{display:inline-block ; white-space:nowrap;height:160px; width:100%;}
.tpgd ul li {margin:30px 0px 0px 20px; display: inline; float:left;width:170px; height:160px;}
.tpgd ul li a{di