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

103
Views
Mantener el estado de una ProgressBar

soy nuevo en Javascript y PHP, estoy codificando algunos temporizadores en tarjetas, pero estos temporizadores deben mostrarse con su propia barra de progreso

esto es lo que acabo de recibir

 <progress class="timer1" value="0" max="100"> </progress> <script src="jQuery.js"> </script> <script> var ar; $(document).ready(function(){ var _sI=[]; $.ii=function(){ ar=arguments; if(ar.length==3){ if(_sI[ar[0]]==undefined){ _sI[ar[0]]={}; }else{ clearInterval(_sI[ar[0]].reg); } _sI[ar[0]].fn=ar[2]; _sI[ar[0]].t=ar[1]; _sI[ar[0]].reg=setInterval(ar[2],ar[1]); }else if(ar.length==1){ clearInterval(_sI[ar[0]].reg); }}}); </script> <script> $( document ).ready(function(){ $.ii('t1',36000,function(){ t1v=$('.timer1').val(); if(t1v<100){$('.timer1').val(t1v+1); }else{$.ii('t1'); } }); }); </script>

esto funciona BIEN, la barra aumentó su tamaño cada 36 segundos, mi problema aquí es

necesito actualizar la página, en este momento la barra se restableció, ¿hay alguna forma de mantener el estado de la barra a través de las actualizaciones?

estoy codificando esto en un servidor apache2 vinculado a un Mysql (MariaDB)

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

0

Sí, guárdelo en el localStorage

 $(document).ready(function () { var value = localStorage.getItem("timer1_value") || 0; $('.timer1').val(value); $.ii('t1', 36000, function () { var t1v = $('.timer1').val(); if (t1v < 100) { $('.timer1').val(t1v + 1); localStorage.setItem("timer1_value", t1v + 1) } else { localStorage.removeItem("timer1_value"); $.ii('t1'); } }); });
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!