如何将模糊屏幕设置为整页,然后单击页面转到TOP

问题描述

|| 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,我得到了这个,但高度不满,我希望它在当前滚动位置而不是顶部,而不是BottOm 当我单击链接时,我的页面将转到顶部并显示为图像。 UPDATE1: 剩下的就是
not to scroll page up|Top
当我单击链接页面上滚至顶部时。 剧本:
// set full page height
    var hei = document.body.offsetHeight;
    $(\'#pop1\').css({height: hei +\'px\'});
    

解决方法

代替
position: absolute
,使用
position: fixed
。 为防止页面跳到顶部,您需要在javascript函数
hidePopup_
中添加
return false
。 链接尝试跳至锚点
#
,由于没有锚点,它跳至顶部。     ,尝试对.parentDisable使用position:static。通常,这会为您提供我认为您想要的更好的结果。