CSS 防止按钮重复点击
2023-03-09 本文已影响0人
hao_developer
如下示意,pointer-events
在0~2秒内的值都是none
,一旦到达2秒,就立刻变成了all
,由于是forwards,会一直保持all的状态

button{
animation: throttle 2s step-end forwards;
}
button:active{
animation: none;
}
@keyframes throttle {
from {
pointer-events: none;
}
to {
pointer-events: all;
}
}