|  |  | 
            
              | เอาไปดู มีสามส่วนพึ่งทำเสร็จเมื่อกี้ แบบกดซ้ายขวา ตัวโค้ดมีสามส่วนเปิดกระดาษเปล่าๆขึ้นมาแล้วใส่ทีละส่วนได้เลย ถ้ารูปภาพมาจากดาต้าเบส จงพิจารณาการเกิดมาของส่วนที่ 3 HTML ว่าควรมายังไงเอ่ย
   
 1. JAVA
 
 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script type="text/javascript">
jQuery(function($) {
    var $gal = $('#gallery'),
        $sli = $('#slider'),
        $box = $('div',$sli),
        W    = $gal.width(), // 500
        N    = $box.length,  // 3
        C    = 0,            // a counter
        intv;
    $sli.width(W*N);
    $('#prev, #next').click(function(){
        C = (this.id=='next' ? ++C : --C) <0 ? N-1 : C%N;
        $sli.stop().animate({left: -C*W },800);  
    });
    function auto(){
      intv = setInterval(function(){
        $('#next').click();
      }, 3000);
    }
    auto(); // start
    $('#gallery').hover(function( e ){
      return e.type=='mouseenter'?clearInterval(intv):auto();
    });
});
</script>
 2. css
 
 <style type="text/css">
#gallery{
  position:relative;
  margin: 0 auto;
  overflow:hidden;
  width:500px;
  height:278px;
}
#slider{
  position:absolute;
  left:0;
  height:278px;
}
#slider > div {
  position:relative;
  float:left;
  width:500px;
  height:278px;
}
#slider > div img{
  width:100%;
}
/* buttons */
#gallery > span{
  cursor:pointer;
  position:absolute;
  width:50px;
  height:100%;
  background:rgba(255,255,255,0.5);
  opacity:0.5;
}
#next{
  right:0px;
}
#gallery > span:hover{
  opacity:1;
}
</style>
 3.HTML
 
 <div id="gallery">
  <div id="slider">
     <div><img src="http://s2.postimg.org/5uxqi0mgl/cats1.jpg" alt=""></div>
     <div><img src="http://s2.postimg.org/66f6us2wl/cats2.jpg" alt=""></div>
     <div><img src="http://s2.postimg.org/ai3sjs9th/cats3.jpg" alt=""></div>
  </div>
  <span id="prev"></span>
  <span id="next"></span>
</div>
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2014-01-27 00:12:55 | By :
                            meannerss |  |  |  
                  |  |  |  |  |  |  |