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

242
Views
easytimer.js restart timer when page refresh or open new window

Good day! Could somebody suggest please.. I am using for record time easytimer.js plugin.

I have a button on the page where there is timer starts when I click it. But the problem is if

someone reloads the page or open new window the timer restarts. I dont know how to use local

storage to make sure my timer does not reset upon reload.

initTimer: function (){

        $(".timer").draggable({
            containment: "window",
            scroll: false,
            cursor: "move"
        });

        var timer = new easytimer.Timer();

       
        $('.timerDetails .startButton').click(function () {
            timer.start();

            //localStorage.setItem('timer', timer);

            $(".timer").css("display", "flex");
            $(".startButton").parent().children().removeClass("active");
            $(".startButton").addClass("active");*/

        });

        $('.timerDetails .pauseButton').click(function () {
            timer.pause();
            $(".pauseButton").parent().children().removeClass("active");
            $(".pauseButton").addClass("active");
        });

        $('.timerDetails .stopButton').click(function () {
            timer.pause();
            $(".stopButton").parent().children().removeClass("active");
            $(".stopButton").addClass("active");

        });


        timer.addEventListener('secondsUpdated', function (e) {
            $('.timerDetails .timer-values').html(timer.getTimeValues().toString());
        });

        timer.addEventListener('started', function (e) {
            $('.timerDetails .timer-values').html(timer.getTimeValues().toString());

        });

        timer.addEventListener('reset', function (e) {
            $('.timerDetails timer-values').html(timer.getTimeValues().toString());
        });

},
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!