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

190
Views
Make the vertical progress bar smooth

can anyone solve my problem of a smooth transition of the progress bar?

I want to reduce the progress bar according to the timer.Currently i'm giving transition to 7s delay and translateX,but whenever i clear the interval, it take some seconds to stop not immediately stops.Is there any other way to achieve this

Here is my code:

const timerHandler = (type = "start") => {
         if (type === "stop" && timer) {
             clearInterval(timer); 
             return;
          }
         let initialSecond = 60;
         timer = setInterval(() => {
            if (initialSecond <= 0) {
            clearInterval(timer);
            return;
        }
        initialSecond--;
       let progressPercent = Math.ceil(100 - (initialSecond * 100) / 60);
       progressBar.style.transform = `translateX(-${progressPercent}%)`;
       progressBar.style.backgroundColor =
          progressPercent >= 50 ? "red" : "#01e327";
}, 1000);
};

Output:

I want the green progress bar to reduce smoothly

about 4 years ago · Juan Pablo Isaza
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!