Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stop ::-webkit-progress-value animation

How can I stop this animation through 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}
}

I've tried this with no success:

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

1 Answers

As far as I know, you can't select pseudo elements with jQuery since they don't technically exist in the DOM tree.

One option would be toggle or add a class to the element:

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

Then you could use the selector .progressLoading.paused::-webkit-progress-value to select the element and pause the animation via the CSS:

.progressLoading.paused::-webkit-progress-value {
    -webkit-animation-play-state: paused;
    animation-play-state: paused;
}
like image 72
Josh Crozier Avatar answered Jul 25 '26 16:07

Josh Crozier



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!