我的問題對於很多人來說相當簡單。 我想擴大div(onClick),以適應外部股利,它應該完全覆蓋所有其他三個股利(不是全屏)點擊展開div
我想使用下面的代碼,但頁面的整個結構當我嘗試這樣做時會感到不安。
<head runat="server">
<title>Untitled Page</title>
<link href="css/jquery-ui.css" rel="stylesheet" type="text/css" />
<script src="js/jquery-1.8.1.min.js" type="text/javascript"></script>
<script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js" type="text/javascript"></script>
<style type="text/css">
.toggler
{
max-width: 500px;
max-height: 270px;
position: relative;
}
.newClass
{
height: 500px;
width: 290px;
display: inline-block;
z-index: 10000px;
float: left;
}
.divClass
{
float: left;
vertical-align: middle;
height: 50px;
width: 500px;
}
</style>
<script type="text/javascript">
$(document).ready(function(){
$('#div1').click(function() {
$('#div1').toggleClass('newClass');
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<table width="100%">
<tr style="height: 100%;">
<td style="width: 30%; height: 500px;">
</td>
<td style="width: 70%; height: 500px;">
<div style="width: 100%; height: 500px;">
<table style="height: 500px; width: 100%;">
<tr>
<td class="toggler">
<div id="div1" style="background-color: Black;">
Hello World!
</div>
</td>
<td style="width: 50%" class="toggler">
<div id="div2" style="background-color: Blue; width: 100%; height: 100%;">
</div>
</td>
</tr>
<tr>
<td style="width: 50%" class="toggler">
<div id="div3" style="background-color: Red; width: 100%; height: 100%;">
</div>
</td>
<td style="width: 50%" class="toggler">
<div id="div4" style="background-color: Maroon; width: 100%; height: 100%;">
</div>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</form>
究竟什麼是我的代碼的問題????請幫助..
注意:我也試過addClass與removeClass方法。沒有好結果...
它應該涵蓋所有的DIV?你想3個div不顯示時,onclick div更大的權利?順便說一句,他們爲什麼在桌子上? – Chanckjh
和z-index不使用px – Chanckjh
我需要將此函數應用於所有其他三個div ...並且是的,您是對的,我不想在顯示其他三個div時放大其中任何一個... – writeToBhuwan