日期:2014-05-16  浏览次数:20334 次

固定在页面右小脚的小窗口
我的css是这样的
JScript code
#winpop {
    width: 400px;
    height: 0px;
    position: fixed;
    right: 0;
    bottom: 0;
    border: 1px solid #999999;
    margin: 0;
    padding: 1px;
    overflow: auto;
    display: none;
    background: #FFFFFF;
}


这个只能在chrome上可以
如果把position: fixed;改为绝对定位的话,是不行的,因为我这里有JS操作,其他页面的高度是会变的,我移动右边的滑动栏小窗口会跟着动,而我希望的是固定在页面右小脚。
不知道还有没有其他办法?

------解决方案--------------------
HTML code

<!doctype html>
<html>
    <head>
        <meta charset="gb2312" />
        <style>
            body { height:1850px; }
            div {
                width:100px; height:100px; border:1px solid red;
                position:absolute; bottom:10px; right:10px;
            }
        </style>
    </head>
    <body>
        <div id="test">123</div>
        <script>
            function $(o){return document.getElementById(o)}
            
            window.onscroll = function(){
                $('test').style.top = document.documentElement.clientHeight + (document.documentElement.scrollTop || document.body.scrollTop) - 110 +'px' 
            }
        </script>
    </body>
</html>