gpt4 book ai didi

javascript - 如何将幻灯片应用于向上或向下移动的元素

转载 作者:行者123 更新时间:2023-11-30 15:09:59 25 4
gpt4 key购买 nike

<分区>

我想应用 .slideUp() 或类似的元素,这些元素在淡出的元素消失后留下。并在它们被重新出现的元素向下推时应用 slideDown()。关键是我希望元素移动起来轻松自如。感谢大家的帮助!!下面的片段可能会更好地解释:

var myJson = [];
//Accordion-----------------------------------------------
$(".accordion-desc").fadeOut(0);
$(".accordion").click(function () {
$(".accordion-desc").not($(this).next()).slideUp('fast');
$(this).next().slideToggle(400);
});


$(".accordion").click(function () {
$(".accordion").not(this).find(".rotate").removeClass("down");
$(this).find(".rotate").toggleClass("down");
});
//-----------------------------------------------------------

//SearchFilter
$("#searcheBar").on("keyup", function () {
var g = $(this).val().toLowerCase();
$(".accordion #title").each(function () {
var s = $(this).text().toLowerCase();
if (s.indexOf(g) !== -1) {
$(this).parent().parent().fadeIn();
}
else {
$(this).parent().parent().fadeOut();
}
});
});
body {
background-color: #eee;
font-family: "Open Sans", sans-serif;
}

header {
background-color: #2cc185;
color: #fff;
padding: 2em 1em;
margin-bottom: 1.5em;
}

h1 {
font-weight: 300;
text-align: center;
}

.container {
position: relative;
margin: 0 auto;
}

button {
background-color: #2cc185;
color: #fff;
border: 0;
padding: 1em 1.5em;
}

button:hover {
background-color: #239768;
color: #fff;
}

button:focus {
background-color: #239768;
color: #fff;
}

.accordion {
position: relative;
background-color: #fff;
display: inline-block;
width: 100%;
border-top: 1px solid #f1f4f3;
border-bottom: 1px solid #f1f4f3;
font-weight: 700;
color: #74777b;
vertical-align: middle;
}
/*Rotation-------------------------------------*/
.accordion .fa {
position: relative;
float: right;
}
.rotate {
-moz-transition: all 0.3s linear;
-webkit-transition: all 0.3s linear;
transition: all 0.3s linear;
}

.rotate.down {
-moz-transform: rotate(90deg);
-webkit-transform: rotate(90deg);
transform: rotate(90deg);
}
/*------------------------------------------*/
.link {

text-align: right;
margin-bottom: 20px;
margin-right: 30px;
}

.accordion h4 {
position: relative;
/* top: 0.8em; */
margin: 0;
font-size: 14px;
font-weight: 700;
float: left;
}

.accordion a {
position: relative;
display: block;
color: #74777b;
padding: 1em 1em 2.5em 1em;
text-decoration: none;
}

.accordion a:hover {
text-decoration: none;
color: #2cc185;
background-color: #e7ecea;
transition: 0.3s;
}

.accordion-desc {
background-color: #f1f4f3;
color: #74777b;
z-index: 2;
padding: 20px 15px;
}
@media (min-width:480px) {

.container { max-width: 80%; }
}
@media (min-width:768px) {

.container { max-width: 1000px; }
}
.accordion-desc p {
word-break: break-all;
}

.accordion .status {
position: relative;
float: right;
right: 20%;
vertical-align: middle;
}
.btn {
margin-top: 10px;
}
.heading {
margin:10px 0px 10px 0px;
vertical-align: middle;
display: inline-block;
position: relative;
width: 100%;
}

.heading h2 {
float: left;
position: relative;
margin:auto;
vertical-align: middle;
}
.heading .searcheBar {
float: right;
position: relative;
margin: auto;
vertical-align: middle;

}
.checkboxInput {
float: right;
position: relative;
margin: auto;
vertical-align: middle;
right: 40%;
}
.semi {
min-height: 50px;

}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="container">
<b>Type 1, 2 or 3 in the text box</b>

<div class="heading">
<input class="searcheBar form-control" id="searcheBar" type="text" />
</div>

<div class="accordion">
<a href="#">
<h4 id="title">1</h4>
<h4 class="status">@Resource.AccordionStatus</h4>
<i class="fa fa-chevron-right rotate"></i>
</a>
</div>
<div class="accordion-desc">
<h3>@Resource.AccordionProjectLead</h3>
<h4>Kay Wiberg</h4>
<h3>@Resource.AccordionDescription</h3>
<p>
@item.Description
<p>
<div class="link">
<a class="btn btn-success" href="@item.Url">@Resource.AccordionGoTo</a>
</div>
</div>

<div class="accordion">
<a href="#">
<h4 id="title">2</h4>
<h4 class="status">@Resource.AccordionStatus</h4>
<i class="fa fa-chevron-right rotate"></i>
</a>
</div>
<div class="accordion-desc">
<h3>@Resource.AccordionProjectLead</h3>
<h4>Kay Wiberg</h4>
<h3>@Resource.AccordionDescription</h3>
<p>
@item.Description
<p>
<div class="link">
<a class="btn btn-success" href="@item.Url">@Resource.AccordionGoTo</a>
</div>
</div>

<div class="accordion">
<a href="#">
<h4 id="title">3</h4>
<h4 class="status">@Resource.AccordionStatus</h4>
<i class="fa fa-chevron-right rotate"></i>
</a>
</div>
<div class="accordion-desc">
<h3>@Resource.AccordionProjectLead</h3>
<h4>Kay Wiberg</h4>
<h3>@Resource.AccordionDescription</h3>
<p>
@item.Description
<p>
<div class="link">
<a class="btn btn-success" href="@item.Url">@Resource.AccordionGoTo</a>
</div>
</div>


<div>

</div><!-- end of container -->

</div><!-- end of accordion-container -->

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