如何将模糊屏幕设置为整页并在点击页面转到TOP

时间:2011-05-23 13:59:08

标签: html css

CSS1工作:

.parentDisable
{    
        z-index:2000;
        width:100%;
        height:100%;
        display:none;
        position:absolute;

        left:0;
        background: url(/images/btrans.png) repeat;
        color: #aaa;
}
#popup
{
    width:300px;
    height:auto;
    position:absolute;
    background-color: whitesmoke;
    color: #6699ff;
    top:40%;
    left: 40%;
}

CSS2无效:

    display:none;
    z-index:2000;
    position: absolute;
    width: 100%;
    top: 0;
    left: 0;
    background: #000;
    opacity: 0.5;
    filter: alpha(opacity=50); 

HTML

<div id="pop1" class="parentDisable">
            <center>
                <div id="popup">
                    <div id="loading"> </div>
                    <div id="popupText" align="left"> </div>
                    <a href="#" onClick="return hidePopup_('pop1')" >
                        <img style="position: absolute;top: 0;right: 0" alt="close" src="/images/close.png" width="40px" height="40px"/>
                    </a>
                </div>
            </center>
</div>

使用CSS1我得到了这个但不是完整的 HEIGHT 我希望这在当前的滚动位置而不是TOP而不是BOTTOm 当我点击链接时,我的页面会转到顶部并显示为图像。 enter image description here UPDATE1
剩余是not to scroll page up|Top 当我点击链接页面向上滚动到TOP。 脚本:

// set full page height
    var hei = document.body.offsetHeight;
    $('#pop1').css({height: hei +'px'});

2 个答案:

答案 0 :(得分:1)

而不是position: absolute使用position: fixed

要防止该网页跳到顶部,您需要在javascript-function return false中添加hidePopup_

链接尝试跳转到锚#,因为没有链接,它会跳到顶部。

答案 1 :(得分:0)

尝试使用position:static for .parentDisable。这通常会为我认为您正在寻找的内容提供更好的结果。