我有一个要打开和关闭的信息表。但我需要表格出现在另一个 DIV 上方。
我可以在 info 表上使用 z-index 和 position:absolute 获得我想要的效果,但是没有 pos:absolute 是否可以达到相同的结果?也许与 pos:relative?我已经尝试过了,它似乎不起作用。
到目前为止,所有代码都非常简单,就是这样。
HTML
<div id="btnDiv"></div>
<table id="infoTable">
<tr>
<td>Objective Details</td>
<td>Add task(btn) Image</td>
</tr>
</table>
<div class="content">CONTENT</div>
CSS
#infoTable{
display: none;
position: relative;
z-index: 10;
}
#btnDiv{
width: 20px;
height: 20px;
background-color: green;
float: right;
}
.content{
width:100%;
height:700px;
background-color: blue;
}
jQuery
$("#btnDiv").click(function showNewDiv(){
$('#popIn').show();
$("#popIn").css("z-index", 1);
});
干杯!