• ie浏览器div随滚动条滚动



     第一种方法:

    html,body{height:100%; 100%; overflow:hidden}
    #content{ height:100%; overflow:auto; overflow-x:hidden; 100%}//#content可换成body


    <div id="content">
    <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />  <br /><br /><br /><br /><br />
    <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
    <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
        
    <br /><br /><br /><br /><br /><br /><br /><br />
        
    </div>
        
    <div style="200px; height:200px; position:absolute; z-index:1; border:solid 1px #000000; left:0; top:80px; background:#eee;"> </div>

     第二种方法:

    <!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">
    <head>
        
    <title>Untitled Page</title>
    </head>
    <body>
        
    <div style="height: 1000px">
        
    </div>
        
    <img id="imgico" style="position: absolute" src="http://www.baidu.com/img/baidu_logo.gif" />
    </body>
    </html>

    <script type="text/javascript">
       
       
        
    function $(id){return document.getElementById(id);}
       
        
        
    function ScrollImg(id)
        
    {
            
    var img = $(id);
            img.style.top 
    = (document.documentElement.scrollTop+(document.documentElement.clientHeight -img.offsetHeight)/2)+"px";
        }
     

        $(
    "imgico").style.left = (document.documentElement.clientWidth - $("imgico").offsetWidth) +"px"
        ScrollImg(
    "imgico");  
        window.onscroll
    =function()
       
    {
            ScrollImg(
    "imgico");
       }
      
    </script>
  • 相关阅读:
    算法学习概述(2016.6)
    java异常和错误类总结(2016.5)
    java string 细节原理分析(2016.5)
    MySQL 5.7.18 解压版安装
    Struts2的<s:date>标签使用详解[转]
    jprofile查看hprof文件[转]
    iBatis的Settings节点参数详解[转]
    window.open、window.showModalDialog和window.showModelessDialog 的区别[转]
    oracle 字典表查询
    oracle 表空间操作
  • 原文地址:https://www.cnblogs.com/554006164/p/1510029.html
Copyright © 2020-2023  润新知