나는 토글 소방관을 클릭하면 height:auto
으로 애니메이트되기를 원하지만 아무 것도 일어나지 않는 것 같습니다. 숨겨진 내용이있는 아코디언이 height:0
으로 설정되어 있습니다. CSS3와 같은 최신 솔루션에 의존 할 수 없습니다.아코디언 높이가 작동하지 않음
http://codepen.io/anon/pen/uaytq
HTML :
<div class="collapse-group">
<div class="collapse-header">
<h1>Some Title</h1>
</div>
<div class="collapse-toggle">
<div class="icon">+</div>
</div>
<div class="collapse-content">
Check out all this filler content! Check out all this filler content! Check out all this filler content! Check out all this filler content! Check out all this filler content! Check out all this filler content! Check out all this filler content! Check out all this filler content! Check out all this filler content! Check out all this filler content! Check out all this filler content! Check out all this filler content! Check out all this filler content! Check out all this filler content! Check out all this filler content!
</div>
</div>
jQuery를 :
$('.collapse-toggle').click(function() {
var that = $(this).find('.collapse-content');
that.animate({'height':'auto'}, 500);
});
CSS :
.wrap {
background:#999999;
margin:0 auto;
width:500px;
}
.collapse-toggle {
background: transparent;
position: absolute;
left: 50%;
margin-left: -30px;
bottom: -60px;
cursor: pointer;
}
.collapse-toggle .icon {
width: 60px;
height: 60px;
font-size: 80px;
line-height: 60px;
text-align: center;
vertical-align: middle;
position: relative;
margin: 0 auto;
color: #f79727;
background: white;
z-index: 9;
}
.collapse-group {
*zoom: 1;
position: relative;
padding-top: 2em;
}
.collapse-group:before,
.collapse-group:after {
content: "";
display: table;
}
.collapse-group:after {
clear: both;
}
.collapse-group.we-create {
padding-top: 0;
}
.collapse-group.orange {
background: #f79727;
}
.collapse-group.orange .section-headline,
.collapse-group.orange .section-tagline {
color: white;
}
.collapse-group.orange .icon {
color: white;
background: #f79727;
}
.collapse-group .collapse-content {
height: 0;
overflow: hidden;
}
모든 '.collpase-content' 섹션에는 가변 높이가 있습니다. 따라서 고정 높이를 150으로 설정하면 작동하지 않습니다. – itsclarke
업데이트 된 답변 확인 ...이 작업이 트릭입니까? – henser