html - CSS3 过渡只工作一次
问题描述
我需要为刷新图标设置动画以在单击它时对其进行旋转。我找到了一种通过 CSS 实现的方法。
css 文件
.refresh:focus .mat-icon {
animation: rotate 2s ease-in-out;
}
@keyframes rotate {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
.html 文件
<button mat-icon-button class="refresh" color="primary" (click)="refreshTableFkeys()">
<mat-icon aria-label="Example icon-button with a heart icon">refresh</mat-icon>
</button>
<button mat-icon-button color="primary" (click)="addNewFkey()">
<mat-icon aria-label="Example icon-button with a heart icon">add</mat-icon>
</button>
当我单击按钮时,图标会旋转一次。当我再次单击它以再次刷新时,动画停止工作。如何在每次点击时触发动画?
提前致谢。
编辑:打字稿
refreshTableFkeys() {
this.dataSource_Fkeys.paginator._changePageSize(this.dataSource_Fkeys.paginator.pageSize);
}
解决方案
推荐阅读
- linux - CMAKE 交叉编译后构建命令
- devexpress - 如何在 Devexpress Gantt 中添加 cellClick 或 Rowclick?
- mongodb - Model.find Mongoose 6.012 总是返回所有文档,即使有过滤器
- java - 代理 websocket wss:// 到 ws:// spring cloud gateway
- reactjs - 删除包 json 中的别名并将它们添加到 monorepo 示例应用程序中的依赖项中
- python - 试图在python中将日期/时间戳命名为文件名
- c++ - 这段代码重新分配字符以使所有字符串相等的问题是什么?
- android - GoogleSignIn requestPermission 未重新调整 ServerAuthCode
- javascript - 使用 CSS 动态调整字段高度
- python - 如何在执行 test.py 时解决此错误?