不管滚动条怎么拉,div始终相对屏幕位置不变,就像网易空间右下角的那种,一点都不卡,请高手指导指导。

解决方案 »

  1.   

    <div style="background: none repeat scroll 0% 0% Red; width: 100px; height: 100px; bottom: 10px; right: 10px; position: fixed;"></div>
      

  2.   

    关键的样式:xxx{bottom:10px;right:10px;position:fixed;}
      

  3.   

    ie6还要看这个
    http://bbs.blueidea.com/thread-2930592-1-1.html
      

  4.   

    LZ看看这个例子<html>
    <head>
    <script language = "javascript">
        var checks = 0;
        var GB =0;
        function openwindow()
        {
         checks = document.getElementById("player").style.pixelTop;
         GB = document.getElementById("myplay").style.pixelTop;
        }
    function move()
    {
    document.getElementById("player").style.pixelTop = checks + document.body.scrollTop;
    document.getElementById("myplay").style.pixelTop = GB + document.body.scrollTop;
    }
    function guna()
    {
    document.getElementById("myplay").style.display = "none";
    document.getElementById("player").style.display = "none";
    }
    window.onscroll = move;
    </script>
    </head>
    <body onload = "openwindow()">
    <div id = "play" style = "position:absolute;height:2000px;width:990px;background-color:orange;z-index:1"></div>
    <div id = "player" style = "position:absolute;height:100px;width:100px;left:900px;top:100px;background-color:blue;z-index:2"></div>
    <div id = "myplay" style = "position:absolute;heigth:20px;width:40px;left:970px;top:80px;z-index:3" onclick = "guna()"><font size = 3 color = red><a href = "#">关闭</a></font></div>
    </body>
    </html>
      

  5.   

    postion:fixed  只可惜IE6不支持
      

  6.   

    用 固定定位 IE: 用那个 经典的 模拟固定定位 的CSS  (纯CSS就可实现)