我正在这里进行引导,根据onClick宽度和高度必须增加。我知道了,但问题是宽度随着高度的增加而消失,而高度随过渡而变化。我已经尝试过但无法实现。我的问题是宽度也随过渡而来,第二个问题是当我在几秒钟后单击选项卡时,为什么延迟选项卡才起作用。谁能帮我解决这个问题。
$(document).ready(function() {
$('.hitw-tabs .collapse').on('shown.bs.collapse', function() {
console.log('test....');
$(this).parent().addClass('hitw-tnw');
});
$('.hitw-tabs .collapse').on('hidden.bs.collapse', function() {
console.log('test hidden....');
$(this).parent().removeClass('hitw-tnw');
});
});
.accordion.width .card {
flex-direction: column;
flex-grow: 0;
flex-shrink: 1;
min-width: min-content;
box-shadow: 5px 5px 30px #000;
border: unset;
margin-right: 20px;
padding: 45px 40px;
transition: all 0.4s ease !important;
height: 215px;
}
.accordion.width .card.hitw-tnw {
width: 100%;
height: 500px;
box-shadow: 4px 4px 18px rgba(0, 0, 0, 0.14);
}
.accordion.width .card-body {
width: auto !important;
}
.collapsing {
position: relative;
width: 0;
height: 0;
overflow: hidden;
-webkit-transition-property: height, visibility;
transition-property: height, visibility;
-webkit-transition-property: width, visibility;
transition-property: width, visibility;
-webkit-transition-duration: 0.35s;
transition-duration: 0.35s;
-webkit-transition-timing-function: ease;
transition-timing-function: ease;
}
.collapse.show {
-webkit-transition-property: width, visibility;
transition-property: width, visibility;
width: 100%;
height: auto;
}
.accordion.width {
display: flex;
align-items: flex-start;
}
.accordion.width .card .card-header {
padding-left: 0;
padding-top: 20px;
font-size: 26px;
letter-spacing: 0.69px;
background-color: #fff;
color: #000000;
}
.hitw-tnw .hitw-tabhead {
display: flex;
align-items: center;
transition: all 5s ease-in;
}
.accordion.width .card {
position: relative;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
<div class="accordion width hitw-tabs" id="accordionHorizontalExample">
<div class="card hitw-tnw">
<div class="hitw-tabhead">
<div class="card-header" data-toggle="collapse" data-target="#collapseOne">consectetur adipiscing</div>
</div>
<div id="collapseOne" class="collapse show width" data-parent="#accordionHorizontalExample">
<div class="card-body">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus bibendum ex sed nulla convallis, non pellentesque risus lacinia. Phasellus quis convallis diam. Curabitur nec ullamcorper tortor. Morbi suscipit vita</p>
</div>
</div>
</div>
<div class="card">
<div class="hitw-tabhead">
<div class="card-header" data-toggle="collapse" data-target="#collapseTwo">consectetur adipiscing</div>
</div>
<div id="collapseTwo" class="collapse width" data-parent="#accordionHorizontalExample">
<div class="card-body">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus bibendum ex sed nulla convallis, non pellentesque risus lacinia. Phasellus quis convallis diam. Curabitur nec ullamcorper tortor. Morbi suscipit vita</p>
</div>
</div>
</div>
<div class="card">
<div class="hitw-tabhead">
<div class="card-header" data-toggle="collapse" data-target="#collapseThree">consectetur adipiscing</div>
</div>
<div id="collapseThree" class="collapse width" data-parent="#accordionHorizontalExample">
<div class="card-body">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus bibendum ex sed nulla convallis, non pellentesque risus lacinia. Phasellus quis convallis diam. Curabitur nec ullamcorper tortor. Morbi suscipit vita</p>
</div>
</div>
</div>
<div class="card">
<div class="hitw-tabhead">
<div class="card-header" data-toggle="collapse" data-target="#collapseFour">Reduce Costs</div>
</div>
<div id="collapseFour" class="collapse width" data-parent="#accordionHorizontalExample">
<div class="card-body">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus bibendum ex sed nulla convallis, non pellentesque risus lacinia. Phasellus quis convallis diam. Curabitur nec ullamcorper tortor. Morbi suscipit vita</p>
</div>
</div>
</div>
</div>