2
jquery를 통해 확장 및 축소 작업을 시도했습니다! 그러나 페이지가 다시로드되는 경우에도 토글 (표시 또는 숨기기) 상태를 저장하려고합니다. 쿠키를 사용해야한다는 사실을 알았습니다. 그러나 어떻게 완료되었는지는 모르겠습니까?메뉴에 대한 펼치기/접기 표
는 HTML :
<table width="150px" id="tbl1" class="hvr">
<tr class="header">
<th style="font-weight:500;">Navigation<span>-</span></th>
</tr>
<tr>
<td align="center"><a href="dashboard.php">Home</a></td>
</tr>
<tr>
<td align="center"><a href="slots.php">My Team</a></td>
</tr>
<tr>
<td align="center"><a href="collection.php">All Pokemons</a></td>
</tr>
<tr>
<td align="center"><a href="battlenow.php">Battle</a></td>
</tr>
<tr>
<td align="center"><a href="train.php">Train Pokemon</a></td>
</tr>
<tr>
<td align="center"><a href="tradecenter.php">My Trade</a></td>
</tr>
<tr>
<td align="center"><a href="online.php">Online Members</a></td>
</tr>
<tr>
<td align="center"><a href="members.php">Members</a></td>
</tr>
<tr>
<td align="center"><a href="settings.php">Settings</a></td>
</tr>
<tr>
<td align="center"><a href="logout.php">Logout</a></td>
</tr>
</table>
JQuery와 :
$(document).ready(function(){
$('.header').click(function(){
$(this).find('span').text(function(_, value){return value=='-'?'+':'-'});
$(this).nextUntil('tr.header').slideToggle(100, function(){});
});
});