停止 ::-webkit-progress-value 动画

Stop ::-webkit-progress-value animation

如何通过JS/Jquery停止这个动画?

.progressLoading::-webkit-progress-value {
    box-shadow: inset 0 1px 1px 0 rgba(255, 255, 255, 0.4);
    border-radius: 10px;
    background:
    -webkit-linear-gradient(45deg, transparent, transparent 33%, rgba(0, 0, 0, 0.1) 33%, rgba(0, 0, 0, 0.1) 66%, transparent 66%),
    -webkit-linear-gradient(top, rgba(255, 255, 255, 0.25), rgba(0, 0, 0, 0.2)),
    -webkit-linear-gradient(left, #963a2d, #832417);    
    background-size: 25px 16px, 100% 100%, 100% 100%;
    -webkit-animation: move 5s linear 0 infinite;
}

@-webkit-keyframes move {
    0% {background-position: 0px 0px, 0 0, 0 0}
    100% {background-position: 100px 0px, 0 0, 0 0}
}

我已经试过了,但没有成功:

$(".progressLoading::-webkit-progress-value").css({ '-webkit-animation-play-state': 'paused' });

据我所知,您不能使用 jQuery select 伪元素,因为它们在技术上不存在于 DOM 树中。

一个选项是切换或添加 class 到元素:

$(".progressLoading").addClass('paused');
$(".progressLoading").toggleClass('paused'); // or toggle it

然后您可以使用 select 或 .progressLoading.paused::-webkit-progress-value 到 select 元素并通过 CSS:

暂停动画
.progressLoading.paused::-webkit-progress-value {
    -webkit-animation-play-state: paused;
    animation-play-state: paused;
}