当前位置:编程学习 > JAVA >>

javascript滚动条,动态加载内容

<!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”

补充:web前端 , JavaScript ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,