<div class="codetitle"> <span><a style="CURSOR: pointer" data="87005" class="copybut" id="copybut87005" onclick="doCopy('code87005')"><u>复制代</u></a></span> 代码如下:</div> <div class="codebody" id="code87005"> <br><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <BR><html xmlns="http://www.w3.org/1999/xhtml"> <br> <br><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <br><title>??????</title> <br><script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.js"></script> <br><style type="text/css"> <br>body,ul,li { パディング:0; margin:0} <br>ul,li { list-style:none} <br>.img-scroll {position:relative;マージン:20px 自動; width:440px;} <br>.img-scroll .prev,.img-scroll .next {position:absolute;表示:ブロック;幅:50ピクセル;高さ:100ピクセル;背景色:#000; <br>トップ:0;色:#FFF;テキスト整列:中央; line-height:100px} <br>.img-scroll .prev { left:0} <br>.img-scroll .next { right:0} <br>.img-list {position:relative;幅:320ピクセル;高さ:100ピクセル;マージン左:60px; overflow:hidden} <br>.img-list ul { width:9999px;} <br>.img-list li { float:left;表示:インライン;幅:100ピクセル;マージン右:10px;高さ:100ピクセル;背景色:#BDBDDF;テキスト整列:中央; line-height:100px;} <br></style> <br></head> <br><br> <br><div class="img-scroll"> <br><span class="prev">prev</span> <br><span class="next">next</span> <br><div class="img-list"> <br><ul> <br><li>1</li> <br><li>2</li> <br><li>3</li> <br><li>4</li> <br> </ul> <br> </div> <br> <br><script type="text/javascript"> <br>関数 DY_scroll(wraper,prev,next,img,speed,or) <br>{ <br>var Wraper = $(wraper); <br>var prev = $(prev); <br>var next = $(next); <br>var img = $(img).find('ul'); <br>var w = img.find('li').outerWidth(true); <br>var s = 速度; <br>next.click(function() <br>{ <br>img.animate({'margin-left':-w},function() <br>{ <br>img.find('li') .eq(0).appendTo(img); <br>img.css({'margin-left':0}); <br>}); <br>prev.click(function() <br>{ <br>img.find('li:last').prependTo(img); <br>img.css({'margin-left':-w} ); <br>img.animate({'margin-left':0}) <br>}); <br>if (または == true) <br>{ <br>ad = setInterval(function() { next.click();},s*1000); <br>wraper.hover(function(){clearInterval(ad);},function(){ad = setInterval(function() { next.click();},s*1000);}); <br><br>} <br>} <br>DY_scroll('.img-scroll','.prev','.next','.img-list',3,false); <br></script> <br><br></body> <br></html> <br><br>