我试图瓦解父DIV的子元素的点击如下图所示倒塌的div
HTML
<div class="expand">
<h3>expand this div</h3>
<a href="#" class="collapse" style="display:none;">Collapse</a>
</div>
CSS
.expand{
border:2px dotted green;
}
的jQuery
$('.expand').click(function(){
$(this).stop().animate({
width:'300px',
height:'300px'
});
$('.collapse').show();
});
$('.collapse').on('click',function(){
$('.expand').stop().animate({
width: '300px',
height:'50px'
});
});
它不工作,我试过使用$(this).parent().animation()
太,但也没有工作。
这里应该做些什么改变?
+1谢谢,这真是棒极了。一些有答案的描述将在未来帮助某人。 –
很高兴帮助! –
很高兴看到补充说明。它肯定会帮助别人。 –