• 导航滚动置顶


    好东西就要收藏起来!

     1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
     2 <html xmlns="http://www.w3.org/1999/xhtml"> 
     3 <head> 
     4 <title>兼容IE6的淘宝悬浮工具栏</title> 
     5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
     6 <style type="text/css"> 
     7 body,html{
     8     margin:0;
     9     padding:0;
    10     font-size:12px;
    11     font-family:Arial;font:12px/1 Helvetica, Tahoma, Arial, 5b8b4f53, sans-serif;
    12     background:url() fixed
    13 }
    14 #float{
    15     background:url(http://www.codefans.net/jscss/demoimg/201010/tb2.png) no-repeat -12px -37px;
    16     width:744px;
    17     height:34px;
    18     border:1px solid #C0DBF8;
    19     position:absolute;
    20     top:0
    21 }
    22 #box{
    23     position:relative;
    24     height:500px;
    25     width:744px;
    26     background:#ddd url(http://www.codefans.net/jscss/demoimg/201010/506384_1270823833Kkk2.jpg) no-repeat;
    27 }
    28 </style> 
    29 </head> 
    30 <body> 
    31 <div style="height:300px;background:#eee"></div> 
    32 <div id="box">
    33     <div id="float" ></div>
    34 </div> 
    35 <div style="height:1000px;background:#eee"></div> 
    36 </body> 
    37 </html>
    38 <script type="text/javascript">
    39 var IO=document.getElementById('float'),Y=IO,H=0,IE6;
    40 IE6=window.ActiveXObject&&!window.XMLHttpRequest;
    41 while(Y){H+=Y.offsetTop;Y=Y.offsetParent};
    42 if(IE6)
    43     IO.style.cssText="position:absolute;top:expression(this.fix?(document"+
    44         ".documentElement.scrollTop-(this.javascript||"+H+")):0)";
    45 window.onscroll=function (){
    46     var d=document,s=Math.max(d.documentElement.scrollTop,document.body.scrollTop);
    47     if(s>H&&IO.fix||s<=H&&!IO.fix)return;
    48     if(!IE6)IO.style.position=IO.fix?"":"fixed";        
    49     IO.fix=!IO.fix;
    50 };
    51 try{document.execCommand("BackgroundImageCache",false,true)}catch(e){};
    52  //]]>
    53 </script> 
    View Code

    网上找到的好宝贝~

  • 相关阅读:
    Android检验下载的文件的完整性
    RecyclerView与SwipeRefreshLayout等组合使用后宽度不能填满
    android断点续传实现方案之三
    博客美化,页首波浪
    博客美化,页首的飘雪效果
    博客美化,博客背景图片设置
    博客美化,页脚游动的鱼
    博客美化,左侧下面的卡通小姐姐
    博客美化,右下角的卡通小姐姐
    .Net工厂方法模式(Factory Method Pattern)
  • 原文地址:https://www.cnblogs.com/jessiecaisme/p/3171889.html
Copyright © 2020-2023  润新知