gpt4 book ai didi

javascript - 增加 div 的高度,只有它下面的 div 向下移动,而不是整行

转载 作者:太空宇宙 更新时间:2023-11-04 01:27:22 24 4
gpt4 key购买 nike

我正在做一个元素,点击后 div 的高度会增加,我只希望那个 div 下面的 div 向下移动而不是整行...

现在我的 div 在点击时高度增加,但无法弄清楚如何正确设置它,以便下面的整行不会向下移动。

My Codepen

.section-container {
max-width: 1280px;
margin: 0 auto;
}

.job-title {
text-align: center;
padding: 25px;
background: #444;
margin-bottom: 0;
}

.job-title-container {
position: relative;
}

.job-information-container {
background: #888;
margin-top: 0;
padding: 25px;
display: none;
}

.job-information-container p {
margin-top: 0;
}

.job-plus-icon {
position: absolute;
left: -webkit-calc(50% - 15px);
bottom: -webkit-calc(0% - 15px);
left: calc(50% - 15px);
bottom: calc(0% - 15px);
width: 30px;
transition: transform 0.3s;
}

.to-open {
-webkit-transform: rotate(135deg);
-moz-transform: rotate(135deg);
-ms-transform: rotate(135deg);
-o-transform: rotate(135deg);
transform: rotate(135deg);
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-vdeg);
-ms-transform: rotate(-90deg);
-o-transform: rotate(-90deg);
transform: rotate(-90deg);
}

.to-close {
-webkit-transform: rotate(135deg);
-moz-transform: rotate(135deg);
-ms-transform: rotate(135deg);
-o-transform: rotate(135deg);
transform: rotate(135deg);
}

有什么帮助吗?

最佳答案

你需要把它做成3列,然后把你想叠的放在一起

https://codepen.io/anon/pen/BJNRpO

$('.job-title-container').click(function(){
$(this).next().slideToggle();
if ($(this).children('.job-plus-icon').hasClass('to-close')) {
$(this).children('.job-plus-icon').removeClass('to-close').addClass('to-open');
} else {
$(this).children('.job-plus-icon').removeClass('to-open').addClass('to-close');
}
})
body {
color: #fff;
}

.section-container {
max-width: 1280px;
margin: 0 auto;
}

.job-title {
text-align: center;
padding: 25px;
background: #444;
margin-bottom: 0;
}

.job-title-container {
position: relative;
}

.job-information-container {
background: #888;
margin-top: 0;
padding: 25px;
display: none;
}

.job-information-container p {
margin-top: 0;
}

.job-plus-icon {
position: absolute;
left: -webkit-calc(50% - 15px);
bottom: -webkit-calc(0% - 15px);
left: calc(50% - 15px);
bottom: calc(0% - 15px);
width: 30px;
transition: transform 0.3s;
}

.to-open {
-webkit-transform: rotate(135deg);
-moz-transform: rotate(135deg);
-ms-transform: rotate(135deg);
-o-transform: rotate(135deg);
transform: rotate(135deg);
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-vdeg);
-ms-transform: rotate(-90deg);
-o-transform: rotate(-90deg);
transform: rotate(-90deg);
}

.to-close {
-webkit-transform: rotate(135deg);
-moz-transform: rotate(135deg);
-ms-transform: rotate(135deg);
-o-transform: rotate(135deg);
transform: rotate(135deg);
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
<div class="section-container">
<div class="row">

<div class="col-xs-12 col-md-4 job-container">

<div class="job-title-container">
<h1 class="job-title">Job Title</h1>
<img class="job-plus-icon" src="https://image.flaticon.com/icons/png/512/60/60740.png"/>
</div>

<div class="job-information-container">
<p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use .</p>
</div>

<div class="job-title-container">
<h1 class="job-title">Job Title2</h1>
<img class="job-plus-icon" src="https://image.flaticon.com/icons/png/512/60/60740.png"/>
</div>

<div class="job-information-container">
<p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).</p>
</div>

</div>


<div class="col-xs-12 col-md-4 job-container">

<div class="job-title-container">
<h1 class="job-title">Job Title3</h1>
<img class="job-plus-icon" src="https://image.flaticon.com/icons/png/512/60/60740.png"/>
</div>

<div class="job-information-container">
<p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters.</p>
</div>

<div class="job-title-container">
<h1 class="job-title">Job Title4</h1>
<img class="job-plus-icon" src="https://image.flaticon.com/icons/png/512/60/60740.png"/>
</div>

<div class="job-information-container">
<p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).</p>
</div>

</div>


<div class="col-xs-12 col-md-4 job-container">

<div class="job-title-container">
<h1 class="job-title">Job Title5</h1>
<img class="job-plus-icon" src="https://image.flaticon.com/icons/png/512/60/60740.png"/>
</div>

<div class="job-information-container">
<p>Many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).</p>
</div>


<div class="job-title-container">
<h1 class="job-title">Job Title6</h1>
<img class="job-plus-icon" src="https://image.flaticon.com/icons/png/512/60/60740.png"/>
</div>

<div class="job-information-container">
<p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident.</p>
</div>

</div>


</div>
</div>

关于javascript - 增加 div 的高度,只有它下面的 div 向下移动,而不是整行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47818347/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com