我在我的页面上得到了这个代码:
HTML:
<table class="position2" cellpadding="0" cellspacing="0" border="0">
<tbody><tr valign="top">
<td class="my-width"> <div class="region region-top1">
<div class="block block-menu" id="block-menu-menu-drugie-menu-testowe">
<div class="art-block clearfix">
<div class="art-blockheader"><h3 class="t subject">
Moje kursy</h3>
</div> <div class="art-blockcontent"><ul class="menu"><li class="first leaf"><a href="/?q=node" title="">Test</a></li>
<li class="last leaf"><a href="/?q=node" title="">test2</a></li>
</ul></div>
</div></div>
</div>
</td>
<td class="my-width"> <div class="region region-top2">
<div class="block block-menu" id="block-menu-menu-menu-testowe">
<div class="art-block clearfix">
<div class="art-blockheader"><h3 class="t subject">
Marketing</h3>
</div> <div class="art-blockcontent"><ul class="menu"><li class="first collapsed"><a href="/?q=node" title="">Link testowy</a></li>
<li class="last leaf"><a href="http://drupal.org" title="">Link2</a></li>
</ul></div>
</div></div>
</div>
</td>
<td class="my-width"> <div class="region region-top3">
<div class="block block-menu" id="block-menu-menu-menu-top3">
<div class="art-block clearfix">
<div class="art-blockheader"><h3 class="t subject">
BHP</h3>
</div> <div class="art-blockcontent"><ul class="menu"><li class="first last leaf"><a href="/?q=node" title="">Link testowy</a></li>
</ul></div>
</div></div>
</div>
</td>
<td class="my-width"> <div class="region region-top4">
<div class="block block-menu" id="block-menu-menu-menu-top4">
<div class="art-block clearfix">
<div class="art-blockheader"><h3 class="t subject">
Zarządzanie</h3>
</div> <div class="art-blockcontent"><ul class="menu"><li class="first last leaf"><a href="/?q=node" title="">Link testowy</a></li>
</ul></div>
</div></div>
</div>
</td>
<td class="my-width"> <div class="region region-top5">
<div class="block block-menu" id="block-menu-menu-menu-top5">
<div class="art-block clearfix">
<div class="art-blockheader"><h3 class="t subject">
E-learning</h3>
</div> <div class="art-blockcontent"><ul class="menu"><li class="first last leaf"><a href="/?q=node" title="">Link testowy</a></li>
</ul></div>
</div></div>
</div>
</td>
</tr>
</tbody></table>
并使用 css:hover 简单地隐藏 art-blockcontent div
.position2 .art-blockcontent {
display: none;
}
.position2:hover .art-blockcontent {
display: block;
}
我需要在点击时将其转换为 javascript。单击显示,然后单击隐藏。
我试过这个:
$(".position2").click(function () {
$(".art-blockcontent").toggle("slow");
});
但它不起作用。有什么建议么?