- 开始展示四个(height:固定值),点击查看更多btn展示全部数据(height:auto),并隐藏查看更多btn($(this).hide())
// x.html
<div>
<div class=’list'>
<img />
<img />
<img />
</div>
<div class=’more_btn'>查看更多</div>
</div>
//x.css
.list{
height:500px;
}
//x.js
$('.more_btn').click(function(){
$('.list').css('height','auto')
$(this).hide();
})
掩耳盗铃式
网友评论