我有一个将在处理请求时显示的div。我想要这样:
但是,当执行Javascript时,div会从右下角缩放到左上角,并且右下角位于屏幕的绝对中心。
有没有办法使div的中心从他的中心和div_fundo_escuro_total
的绝对中心开始?
$("#div_fundo_escuro_total").fadeIn({
duration: 300,
complete: function() {
$("#div_info_fundo_escuro").show('scale', {}, 250);
}
});
#div_fundo_escuro_total {
width: 100%;
height: 100%;
z-index: 2000;
background-color: rgba(0, 0, 0, 0.3);
position: fixed;
top: 0px;
left: 0px;
display: none;
}
#div_info_fundo_escuro {
width: 40%;
min-height: 60%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: #fff;
display: none;
align-items: center;
justify-content: center;
border: 1px #444444 solid;
box-shadow: 2px 4px 10px 2px #555;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<div id="div_fundo_escuro_total">
<div style="width:100%; height: 100%; position: relative;">
<div id="div_info_fundo_escuro">
Processando this foobar
</div>
</div>
</div>