我正在做一個div來展開點擊的高度。我嘗試了一些我在這裏找到的方法,但沒有爲我工作。點擊展開div與轉換
jQuery('.readMore').click(function() {
jQuery(this).parent().toggleClass('rm-cont-hidden');
});
.rm-container {
float: left;
width: 100%;
background: #f7f7f7;
margin-bottom: 10px;
padding: 10px;
font-size: 13px;
color: #777;
}
.rm-text {
float: left;
width: 100%;
}
.rm-container.rm-cont-hidden .rm-text {
max-height: 34px;
overflow: hidden;
transition: max-height 0.3s ease-out;
}
.rm-container .rm-text {
max-height: auto;
transition: max-height 0.3s ease-in;
}
.readMore {
float: left;
width: 100%;
color: blue;
text-align: center;
padding: 5px 0px 0px 0px;
font-size: 16px;
}
.readMore:hover {
color: green;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="container">
<div class="row">
<div class="col-xs-4">
<div class="rm-container rm-cont-hidden">
<div class="rm-text">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
</div>
<div class="readMore">
+
</div>
</div>
</div>
</div>
</div>
我想股利爲 「開/擴展」 與過渡。
你應該確切的最大高度,不要使用最大高度:汽車。 https://jsfiddle.net/yetb8ntp/3/ –