1
我正在尝试在部分之间进行转换。
1.向上滑动电流部分并应用“已完成”类。
2.然后滑动下一节了从底层应用类“活动”
jQuery onClick slideUp&addClass不起作用
我也想知道如何滑动部分,然后
删除类,因为它的所有在同一时间
其发生原因它在它滑落之前消失。
HTML:
<section class="active">
<h1>Hi, how are you?</h1>
<p>This is paragraph text!</p>
<button class="btn">Next</button>
</section>
<section>
<h1>Section number two.</h1>
<p>This is paragraph text!</p>
<button class="btn">Next</button>
</section>
<section>
<h1>Section number three.</h1>
<p>This is paragraph text!</p>
<button class="btn">Next</button>
</section>
CSS:
section {
display: none;
width: 400px;
background: rgba(000,000,000,.3);
border-radius: 5px;
text-align: center;
padding: 5px 0;
font-family: helvetica, sans-serif;
}
.active {
display: block;
}
的jQuery:
$('button').click(function() {
$('.active').slideUp('fast').removeClass('active').addClass('completed');
$(this).next("section").slideUp().addClass('active');
});
目前尚不清楚你的问题是什么。您是否遇到过“onClick”问题?或者你只想'addClass'在'slideUp'之后发生?另外,你可以修剪你的CSS只显示相关的样式? –