当我为 jQuery 单击 Toggle 时,我需要删除 .hidesome 并将其更改为 .show ,反之亦然。
无法得到这个......它已经搜索了 4 个小时。
<a href="#" class="button">Toggle</a>
<div class="signatureContain">
<div class="signature hidesome">
When the button above is pressed you should see the rest<br />
"the rest"
</div>
</div>
<a href="#" class="button">Toggle</a>
<div class="signatureContain">
<div class="signature hidesome">
When the button above is pressed you should see the rest<br />
"the rest"
</div>
</div>
('.signatureContain').live('click',function(){
if ($(this).hasClass('hidesome'))
{
$(this).removeClass('hidesome');
$(this).addClass('show');
} else
{
$(this).removeClass('show')
$(this).addClass('hidesome');
}
});
.hidesome{ height:20px;overflow:hidden}
.show{ height:auto }