我有一個條形圖,動畫與CSS3和動畫當前激活當頁面加載。動畫開始時滾動
我遇到的問題是,給定的條形圖由於之前有很多內容而被放置在屏幕上,所以在用戶向下滾動到該動畫時,動畫已經完成。
我正在尋找通過CSS3或jQuery的方式,以便在查看器查看圖表時激活條形圖上的CSS3動畫。
.animation {
width: 1000px;
margin: 50px auto;
}
table {
width: 100%;
}
.tr-box table,
.tr-box tr,
.tr-box td {
border: 1px solid black;
border-collapse: collapse;
}
.tr-box tr td:first-child {
width: 20%;
text-align: center;
}
.tr-box {
margin-bottom: 20px;
}
.tr-box tr td {
padding: 10px;
}
.a-box-animation {
height: 40px;
width: 100%;
-webkit-animation-name: box;
animation-name: box;
-webkit-animation-duration: 6s;
animation-duration: 6s;
-webkit-animation-iteration-count: 1;
animation-iteration-count: 1;
-webkit-animation-fill-mode: forwards;
animation-fill-mode: forwards;
-webkit-animation-timing-function: ease-in-out;
animation-timing-function: ease-in-out;
}
@keyframes box {
0% {
width: 0%;
background-color: blue;
}
100% {
background-color: blue
}
}
<section id="popularity">
<div class="animation ">
<h2>Most popular books</h2>
<div class='tr-box'>
<table>
<tr>
<td>The Snowman</td>
<td>
<div class="a-box-animation">
</div>
</td>
</tr>
</table>
</div>
</div>
</section>
=======