Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

172
Views
How to access keyframes & webkit transform in javascript?

I want to create a circular progressbar in Html, Javascript and css.

This here is my code:

<div class="progress blue"> <span class="progress-left"> <span class="progress-bar"></span> </span> <span class="progress-right"> <span class="progress-bar"></span> </span>
                  <div class="progress-value">70%</div>
              </div>
@keyframes loading-2 {
    0% {
        -webkit-transform: rotate(0deg);
        transform: rotate(0deg)
    }

    100% {
        -webkit-transform: rotate(50deg);
        transform: rotate(50deg)
    }
}

I have found following answer to my question on stackoverflow

element.style.webkitTransform = "rotate(-2deg)";

but I have 2 keyframes and 2 webkit transform elements, so how can I select the 2nd one?

the 1 that I want to access is the

100% {
        -webkit-transform: rotate(50deg);
        transform: rotate(50deg)
    }

how can I do this in javascript so I can make my progress bar dynamically?

I tried to use this answer here: How to set the style -webkit-transform dynamically using JavaScript?

but as I said I have 2 keyframe elemnts and 2 webkit transform elements and I cant acces them with element.style.webkitTransform = "rotate(-2deg)";

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can set a classe from your JavaScript with your parameters?

Put this code in your js:

document.querySelector(".progress").classList.add(".newClasse")

Put this code in your css:

.newClasse {
   -webkit-transform: rotate(0deg);
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!