use*_*268 2 html javascript css jquery
当您单击链接时,在显示/隐藏切换期间应用任何 CSS 动画。切换有效,但未应用动画。
$('.working-hours-link').click(function(e) {
$(this).siblings(".hours").toggleClass('hidden shown');
});Run Code Online (Sandbox Code Playgroud)
.hidden {
background-color: #fff;
color: #000;
-webkit-transition: all 1s;
-moz-transition: all 1s;
-o-transition: all 1s;
transition: all 1s;
display: none;
}
.shown {
background-color: #000;
color: #fff;
-webkit-transition: all 1s;
-moz-transition: all 1s;
-o-transition: all 1s;
transition: all 1s;
display: block;
}Run Code Online (Sandbox Code Playgroud)
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<a class="working-hours-link" href="#">Show working hours</a>
<br>
<div class="hours hidden">
Sunday: 12:00 pm-6:00 pm
</div>Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
969 次 |
| 最近记录: |