小编Fel*_*ete的帖子

如何使用 JS 更改@keyframes?

我在用着

#progressBar{
   background-color: #247BA0;
   width: 150px;
   padding: 10px;
   border-radius: 5px;
   animation: progressBar 3s ease;
   animation-fill-mode:both; 
   text-align: center;
   box-sizing: content-box;
} 
Run Code Online (Sandbox Code Playgroud)

@keyframes progressBar {
 0% { width: 0; }
100% { width: 280px; }
}
Run Code Online (Sandbox Code Playgroud)

我想改变@keyframe使用JS变量的宽度数。我怎样才能做到这一点(没有 jQuery)?

javascript css keyframe css-animations progress-bar

5
推荐指数
2
解决办法
1万
查看次数

标签 统计

css ×1

css-animations ×1

javascript ×1

keyframe ×1

progress-bar ×1