function DY_scroll(img,speed,or){
var wraper = $("#"+img).find('dl');
var w = wraper.find('dd').outerWidth(true);
var s = speed;
next = function(){
wraper.animate({'margin-left':-w},function(){
wraper.find('dd').eq(0).appendTo(wraper);
wraper.css({'margin-left':0});
});
};
if (or == true){
eval("set_"+img+"=setInterval(function() { next();},s*1000);");
wraper.hover(function(){
eval("clearInterval(set_"+img+");");
},function(){
eval("set_"+img+"=setInterval(function() { next();},s*1000);");
});
}
}
<div class="indexhj box">
<div class="c" id="tabhj">
<dl>
<dd><u><img src="/images/w/hj/hj1.jpg"></u><p>检验室</p></dd>
<dd><u><img src="/images/w/hj/hj2.jpg"></u><p>输液大厅</p></dd>
<dd><u><img src="/images/w/hj/hj3.jpg"></u><p>医院大厅</p></dd>
<dd><u><img src="/images/w/hj/hj4.jpg"></u><p>医院大厅</p></dd>
<dd><u><img src="/images/w/hj/hj5.png"></u><p>护士站</p></dd>
<dd><u><img src="/images/w/hj/hj6.png"></u><p>病房</p></dd>
</dl>
</div>
</div>
<script>DY_scroll('tabhj',5,true);</script>
带控制按钮:
function DY_scroll(wraper,prev,next,img,speed,or){
var timeid = wraper;
var wraper = $("."+wraper);
var prev = $(prev);
var next = $(next);
var img = $(img).find('dl');
var w = img.find('dd').outerWidth(true);
var s = speed;
next.click(function(){
img.animate({'margin-left':-w},function(){
img.find('dd').eq(0).appendTo(img);
img.css({'margin-left':0});
});
});
prev.click(function(){
img.find('dd:last').prependTo(img);
img.css({'margin-left':-w});
img.animate({'margin-left':0});
});
if (or == true){
eval("set_"+timeid+"=setInterval(function() { next.click();},s*1000);");
//ad = setInterval(function() { next.click();},s*1000);
wraper.hover(function(){
//clearInterval(ad);
eval("clearInterval(set_"+timeid+");");
},function(){
eval("set_"+timeid+"=setInterval(function() { next.click();},s*1000);");
});
}
}
<div class="indexzj">
<div class="t">
<span class="t1"><a href="/ystd/">家团队</a></span>
<span class="btn_right"><a class="zjtd_prev" href="javascript:void(0);" target="_self"><img src="/public/img/indexzj_t1.jpg"/></a></span>
<span class="btn_left"> <a class="zjtd_next" href="javascript:void(0);" target="_self"><img src="/public/img/indexzj_t2.jpg"/></a></span>
</div>
<div class="zjtd_clist">
<dl>
<dd>
<u><img src="/uploads/130710/5-130G0130I0151.jpg"></u>
<h3>主任医师</h3>
<h4>毕业于(现吉...</h4>
<div class="s"><h5>谭书芹</h5><a href="/ystd/201303/12.html"><img src="/public/img/indexzj_1.jpg"/></a> <a href="{dede:type typeid=5}<a href='/ystd/'>医师团队</a>{/dede:type}"><img src="/public/img/indexzj_2.jpg"/></a></div>
</dd>
<dd>
<u><img src="/uploads/130710/5-130G0130I0151.jpg"></u>
<h3>主任医师</h3>
<h4>毕业于(现吉...</h4>
<div class="s"><h5>谭书芹</h5><a href="/ystd/201303/12.html"><img src="/public/img/indexzj_1.jpg"/></a> <a href="{dede:type typeid=5}<a href='/ystd/'>医师团队</a>{/dede:type}"><img src="/public/img/indexzj_2.jpg"/></a></div>
</dd>
<dd>
<u><img src="/uploads/130710/5-130G0130I0151.jpg"></u>
<h3>主任医师</h3>
<h4>毕业于(现吉...</h4>
<div class="s"><h5>谭书芹</h5><a href="/ystd/201303/12.html"><img src="/public/img/indexzj_1.jpg"/></a> <a href="{dede:type typeid=5}<a href='/ystd/'>医师团队</a>{/dede:type}"><img src="/public/img/indexzj_2.jpg"/></a></div>
</dd>
<dd>
<u><img src="/uploads/130710/5-130G0130I0151.jpg"></u>
<h3>主任医师</h3>
<h4>毕业于(现吉...</h4>
<div class="s"><h5>谭书芹</h5><a href="/ystd/201303/12.html"><img src="/public/img/indexzj_1.jpg"/></a> <a href="{dede:type typeid=5}<a href='/ystd/'>医师团队</a>{/dede:type}"><img src="/public/img/indexzj_2.jpg"/></a></div>
</dd>
<dd>
<u><img src="/uploads/130710/5-130G0130I0151.jpg"></u>
<h3>主任医师</h3>
<h4>毕业于(现吉...</h4>
<div class="s"><h5>谭书芹</h5><a href="/ystd/201303/12.html"><img src="/public/img/indexzj_1.jpg"/></a> <a href="{dede:type typeid=5}<a href='/ystd/'>医师团队</a>{/dede:type}"><img src="/public/img/indexzj_2.jpg"/></a></div>
</dd>
</dl>
</div>
<div class="clear"></div>
</div>
<script>DY_scroll('indexzj','.zjtd_prev','.zjtd_next','.zjtd_clist',3,true);</script>