快捷搜索:   MySQL PHP linux 播放器

JavaScript 滚动页面到指定DIV元素位置

<html>  
   <script src="//wow.techbrood.com/libs/jquery/jquery.min.js"></script>  
   <script>  
       $(document).ready(function (){  
           $("#scroll").click(function (){  
               $('html, body').animate({  
                   scrollTop: $("#div1").offset().top  
               }, 2000);  
           });  
       });  
   </script>  
   <ul id="commentlist">  
       <li style="text-align: left">  
           <img src="" alt="">  
           <p class="name">iefreer</p>  
           <span class="time">2015-07-17 16:38:45</span>  
           <p class="comment_content">comment1</p>  
       </li>  
       <li style="text-align: left">  
           <img src="" alt="">  
           <p class="name">iefreer</p>  
           <span class="time">2015-07-17 16:38:25</span>  
           <p class="comment_content">comment2</p>  
       </li>  
       <li style="text-align: left">  
           <img src="" alt="">  
           <p class="name">iefreer</p>  
          &nbs

本文出至:学新通博客网络博客

p;<span class="time">2015-07-17 16:38:02</span>              <p class="comment_content">comment3</p>          </li>      </ul>      <button id="scroll">Scroll me</button>  </html>



您可能还会对下面的文章感兴趣: