초점 그림


  
  
  
  
  1. <script> 
  2. $(function(){ 
  3.     var index = 0; 
  4.     var show_len = $(".show > li").length; 
  5.     $(".list > li").mouseover(function(){ 
  6.         index = $(".list > li").index(this); 
  7.         //$(".list > li").eq(index).addClass("Light").siblings().removeClass("Light"); 
  8.         //$(".show > li").eq(index).show().siblings().hide(); 
  9.         show_img(index); 
  10.         }) 
  11.         $(".show").hover( 
  12.             function(){ 
  13.                 clearInterval(autoplay); 
  14.                 },function(){ 
  15.                     autoplay = setInterval(function(){ 
  16.                         show_img(index); 
  17.                         index++; 
  18.                         if (index==show_len){index=0;} 
  19.                         },3000) 
  20.                     } 
  21.             ).mouseout(); 
  22.              
  23.     }) 
  24.     function show_img(index){ 
  25.         var show_height = $(".show > li").height(); 
  26.         $(".show").stop(true,false).animate({top:-show_height*index},1000); 
  27.         $(".list > li").removeClass("Light").eq(index).addClass("Light"); 
  28.         } 
  29.  
  30. </script> 

 

  
  
  
  
  1. <div id="box"> 
  2.     <ul class="show"> 
  3.         <li><img src="img/1.jpg" /></li> 
  4.         <li><img src="img/2.jpg" /></li> 
  5.         <li><img src="img/3.jpg" /></li> 
  6.         <li><img src="img/4.jpg" /></li> 
  7.         <li><img src="img/5.jpg" /></li> 
  8.     </ul> 
  9.     <ul class="list"> 
  10.         <li class="Light">1</li> 
  11.         <li>2</li> 
  12.         <li>3</li> 
  13.         <li>4</li> 
  14.         <li>5</li> 
  15.     </ul> 
  16. </div> 

 

  
  
  
  
  1. <style> 
  2. * { margin:0; padding:0; border:none; list-style:none;} 
  3. #box { width:500px; height:300px; overflow:hidden; position:relative; margin:30px auto; border:1px solid #000;} 
  4. .show { width:500px; height:auto; position:absolute; top:0; left:0;} 
  5. .show li img { width:500px; height:300px;} 
  6. .list { width:auto; height:20px; position:absolute; right:0px; bottom:5px;} 
  7. .list li { width:20px; height:20px; background:#FC6; text-align:center; line-height:20px; float:left; margin-right:5px; cursor:pointer} 
  8. .list .Light {background:#000; color:#FFF} 
  9. </style> 

좋은 웹페이지 즐겨찾기