很多種做法,我寫個簡單的給妳,css和html自己去改
html:
<div?class="demo"><a?class="open"?href="#">展開</a>
<a?class="close"?href="#">關閉</a>
</div>
css:
.demo{width:?500px;height:?100px;margin:?100px?auto;background:?#0075d5;position:?relative;}.demo?a{color:?#fff;position:?absolute;right:?10px;bottom:?10px;}
.demo?.close{display:?none;}
jQuery:
$(".open"?).click(function(){$(this?).hide().siblings(".close"?).show();
$(".demo"?).animate({height:'300px'},200);
return?false;
});
$(".close"?).click(function(){
$(this?).hide().siblings(".open"?).show();
$(".demo"?).animate({height:'100px'},200);
return?false;
});