首页 > 代码库 > 设置弹窗、遮罩的样式设置(包括:left、heigh等)

设置弹窗、遮罩的样式设置(包括:left、heigh等)

.zhezhao
{
    width:100%;
    background-color:#000;
    filter:alpha(opacity=50);
    -moz-opacity:0.5;
    opacity:0.5;
    position:absolute;
    left:0px;
    top:0px;
    display:none;
    z-index:10;
}
#tanchuang
{
    position:absolute;
    width:400px;
    height:530px;
    background-color:#FFF;
    padding-top:10px;
    padding-left:20px;
    padding-right:15px;
    padding-bottom:20px;
    font-family:"微软雅黑";
    top:240px;
    z-index:80;
    display:none
}
$(".btn").click(function(){
        $(‘#tanchuang‘).css(‘display‘,‘block‘);
        $(‘.zhezhao‘).css(‘display‘,‘block‘);
        var h1 = $(document.body).outerHeight(true);
        var h = h1+"px"
        $(‘.zhezhao‘).css("height",h);
        var w0 = $(window).width(); 
        var w1 = $(‘#tanchuang‘).css(‘width‘);
        var w0 = parseInt(w0);//把字符串转化为数值
        var w1 = parseInt(w1);//把字符串转化为数值
    var w2 = (w0-w1)/2;
    var w2 = w2+"px";

    var w1 = $(‘#tanchuang‘).css(‘left‘,w2); })

 

设置弹窗、遮罩的样式设置(包括:left、heigh等)