javascript捲軸,動態載入內容

來源:互聯網
上載者:User

<!DOCTYPE html PUBliC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<script type="text/javascript" src="http://www.miiceic.org.cn/templets/js/jquery-1.3.1.js"></script>
<title>企業培訓,it培訓,資料庫培訓,android培訓,嵌入式培訓</title>
</head>  
   <script type="text/javascript">
    function insertcode(){
        var $body = $("body");                                                           
        $body.append('<div style=\" height:1000px; font-size:24px;\"><a href=\"http://www.miiceic.org.cn/\" target=\"_blank\">企業培訓</a><br /><a href=\"http://www.amboedu.com/\" target=\"_blank\">職業教育</a><br /><a href=\"http://www.ciitn.com/\" target=\"_blank\">資訊產業培訓網</a><br /><a href=\"http://www.miiceic.org.cn/amt2011/\" target=\"_blank\">android PK Iphone</a><br /></div>')
        $("#page_tag_load").hide();                   
        }
    function endcode(){
        $("#page_tag_load").hide();
    }
    $(document).ready(function(){
         $(window).scroll(function () {
              var $body = $("body");
              var $html = "";
              $html += "<br/>" + ($(window).height() + $(window).scrollTop());
              $html += "<br/>window.height: " + $(window).height();
              $html += "<br/>body.height: " + $body.height();
              $html += "<br/>window.scrollTop: " + $(window).scrollTop();
              $("#page_tag_bottom").html($html);

             /*判斷表單高度與豎向滾動位移大小相加 是否 超過內容頁高度*/
              if (($(window).height() + $(window).scrollTop()) >= $body.height()) {
                  $("#page_tag_load").show();
                  //setTimeout(insertcode, 1000);/*IE 不支援*/
                  if(($(window).height() + $(window).scrollTop())<3000){   
                      insertcode();
                  }
                  else{
                      endcode();   
                  }
              }
          });
      });
    </script>
</head>

<body>
    <div style="height:1000px; font-size:24px;"><a href="http://www.miiceic.org.cn/" target="_blank">企業培訓</a><br /><a href="http://www.amboedu.com/" target="_blank">職業教育</a><br /><a href="http://www.ciitn.com/" target="_blank">資訊產業培訓網</a><br /><a href="http://www.miiceic.org.cn/amt2011/" target="_blank">Android PK Iphone</a><br /><br /><br /><a href="http://www.miiceic.org.cn/amt2011/" target="_blank">跨領域技術體驗峰會</a></div>
    <div id="page_tag_bottom" style="width:100%; position:fixed; _position:absolute;top:0px; background-color:#cccccc;height:120px;"></div>
    <div id="page_tag_load" style=" display:none; font-size:14px;position:fixed; bottom:0px; background-color:#cccccc;height:50px;">載入中...</div>
</body>
</html>
作者“jjklmm”

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.