zoukankan      html  css  js  c++  java
  • JS+CSS随屏幕滚动浮动层

    <!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>JS+CSS随屏幕滚动浮动层</title>
    <style>
     html,body
    {
      height
    :2000px;
     
    }
    </style>
    </head>
    <body>
     <div id="aa" style="200px;height:200px;background:#c0c0c0;" >
     <div align="right"><href="javascript:viod(0)" onclick="divclose()">关闭</a></div>

    </div>

    </body>
    </html>
    <script>
        
    function scroll(p){
         
    var d = document,w = window,o = d.getElementById(p.id),ie6 = /msie 6/i.test(navigator.userAgent);
         
    if(o){
          o.style.cssText 
    +=";position:"+(p.f&&!ie6?'fixed':'absolute')+";"+(p.r?'left':"right")+":0;"+(p.t!=undefined?'top:'+p.t+'px':'bottom:0');
          
    if(!p.f||ie6){
           
    -function(){
               
    var t = 500,st = d.documentElement.scrollTop||d.body.scrollTop,c;
                     c 
    = st  - o.offsetTop + (p.t!=undefined?p.t:(w.innerHeight||d.documentElement.clientHeight)-o.offsetHeight);
                  c
    !=0&&(o.style.top = o.offsetTop + Math.ceil(Math.abs(c)/10)*(c<0?-1:1) + 'px',t=10);
                  setTimeout(arguments.callee,t)
              }() 
          }
         }  
        }
        scroll({
         id:
    'aa'
        
        })
        
    function divclose()
        {
            document.getElementById(
    "aa").style.display='none';
        }
    </script>
  • 相关阅读:
    Educational Codeforces Round 86 (Rated for Div. 2)
    第十六届东南大学大学生程序设计竞赛(春、夏季)
    Codeforces Round #643 (Div. 2)
    [P3384] 【模板】轻重链剖分
    [BJOI2012] 连连看
    [CF1349C] Orac and Game of Life
    Codeforces Round #641 (Div. 2)
    [TJOI2018] 数学计算
    [CF1157D] N Problems During K Days
    [CF1163C1] Power Transmission (Easy Edition)
  • 原文地址:https://www.cnblogs.com/Snowfun/p/2575804.html
Copyright © 2011-2022 走看看