5 Minute circle timer which will work when user opens the page

311 views Asked by At

I need to add 5 Minute circle timer which will work when user opens the page JS custom code in AppGyver. I found a ready code https://codepen.io/SabAsan/pen/zYvpZPM just help me to correct the code little bit, exactly the design of this circle as in the image and write them as one JS code because Appgyver accepts just JS custom code https://docs.appgyver.com/app-logic/custom-javascript

Here's the Axelor JS code type

  function CountDown(duration, display) {
        if (!isNaN(duration)) {
            var timer = duration, minutes, seconds;
            
          var interVal=  setInterval(function () {
                minutes = parseInt(timer / 60, 10);
                seconds = parseInt(timer % 60, 10);

                minutes = minutes < 10 ? "0" + minutes : minutes;
                seconds = seconds < 10 ? "0" + seconds : seconds;

                $(display).html("<b>" + minutes + "m : " + seconds + "s" + "</b>");
                if (--timer < 0) {
                    timer = duration;
                   SubmitFunction();
                   $('#display').empty();
                   clearInterval(interVal)
                }
                },1000);
        }
    }
    
    function SubmitFunction(){
   $('#submitted').html('submitted');
    
    }
    

     CountDown(3,$('#display'));
  
0

There are 0 answers