jquery弹出页面加载

时间:2012-10-18 00:06:24

标签: jquery html css

http://jsfiddle.net/nVZEB/6/

点击此

时应显示弹出窗口

        testingPopup  

但我看到这个问题在页面加载本身的这个问题.... 如何隐藏它,它应该只在弹出窗口中显示

$(function() {

var popup = false;

$(".open").click(function(){
    alert(123);
    if(popup === false){
        $("#overlayEffect").fadeIn("slow");
        $(this).parent().find('.popupContainer').fadeIn("slow");
        $(this).parent().find('.close').fadeIn("slow");
        center();
        popup = true;
    }    
    });

    $(".close").click(function(){
        hidePopup();
    });

    $(".overlayEffect").click(function(){
        hidePopup();
    });

function center(){
    var windowWidth = document.documentElement.clientWidth;
    var windowHeight = document.documentElement.clientHeight;
    var popupHeight = $(".popupContainer").height();
    var popupWidth = $(".popupContainer").width();
    $(".popupContainer").css({
        "position": "absolute",
        "top": 85,
        "left": windowWidth/2-popupWidth/2
    });

    }
function hidePopup(){
    if(popup===true){
        $(".overlayEffect").fadeOut("slow");
        $(".popupContainer").fadeOut("slow");
        $(".close").fadeOut("slow");
        popup = false;
    }
}

} ,jQuery);

1 个答案:

答案 0 :(得分:2)

看起来hidden div上有一个popupContainer课程,但你没有任何风格。

尝试将此添加到您的样式中:

.hidden {
    display: none;
}
相关问题