源码:

 

 
   
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
  2. <html xmlns="http://www.w3.org/1999/xhtml"> 
  3. <head> 
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
  5. <title>无标题文档</title> 
  6. <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script> 
  7. <style> 
  8. /* CSS reset */ 
  9. body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td{ margin:0; padding:0; font-size:12px; font-family:"宋体";} 
  10. table{ border-collapse:collapse; border-spacing:0;} 
  11. fieldset,img{ border:0; display:block;} 
  12. address,caption,cite,code,dfn,em,strong,th,var{ font-style:normal; font-weight:normal;} 
  13. ol,ul{ list-style:none;} 
  14. caption,th{ text-align:left;} 
  15. h1,h2,h3,h4,h5,h6{ font-size:100%; font-weight:normal;} 
  16. .scroll{ width:300px; height:110px; overflow:hidden; position:relative; margin:100px auto 0; border:1px solid #ccc;} 
  17. .scroll ul{ position:absolute; width:3000px;} 
  18. .scroll li{ float:left; padding:5px 0;} 
  19. </style> 
  20. </head> 
  21.  
  22. <body> 
  23.     <div class="scroll"> 
  24.         <ul> 
  25.             <li><a href="#" target="_blank"><img  src="images/1-1.jpg" width="100" height="100"/></a></li> 
  26.             <li><a href="#" target="_blank"><img  src="images/1-2.jpg" width="100" height="100"/></a></li> 
  27.             <li><a href="#" target="_blank"><img  src="images/1-3.jpg" width="100" height="100"/></a></li> 
  28.             <li><a href="#" target="_blank"><img  src="images/1-4.jpg" width="100" height="100"/></a></li> 
  29.             <li><a href="#" target="_blank"><img  src="images/1-5.jpg" width="100" height="100"/></a></li> 
  30.             <li><a href="#" target="_blank"><img  src="images/1-6.jpg" width="100" height="100"/></a></li> 
  31.         </ul> 
  32.     </div> 
  33.  <script src="scroll.js"></script> 
  34.  <script type="text/javascript"> 
  35.      function AutoPlay(){ 
  36.         var _scroll = $(".scroll ul"); 
  37.         _scroll.animate({marginLeft : "-100px"},1000,function(){ 
  38.             _scroll.css({marginLeft : "0px"}).find("li:first").appendTo(this);   
  39.         });  
  40.     } 
  41.     jQuery(function(){ 
  42.         var t = setInterval(function(){ 
  43.             AutoPlay();  
  44.         },3000); 
  45.         $(".scroll").hover(function(){ 
  46.             clearInterval(t);    
  47.         },function(){ 
  48.             t = setInterval(function(){ 
  49.                 AutoPlay();  
  50.             },3000);     
  51.         })   
  52.     })   
  53.  </script> 
  54. </body> 
  55. </html>