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

220
Views
Efecto de reescritura de palabras en Javascript

Estoy cambiando texto en un bucle para efectos visuales. Así es como se ve https://naejc.github.io/Script/GodsLies

este es el codigo

 const symbols = ['God', 'Words']; let count = 0; const element = document.getElementById("WORD1"); const iteration = () => { element.innerHTML = symbols[parseInt(count / 2, 10) % symbols.length]; if (count % 2 !== 0) { element.classList.add("LANGUAGE"); } else { element.classList.remove("LANGUAGE"); } count++; if (count === symbols.length * 2) { count = 0; } }; let inthandle = setInterval(iteration, 270); iteration();

¿Puede alguien decirme cómo puedo usar este script en más de una instancia? No tiene efecto si se usa de nuevo, intentando crear otro elemento que cambie el texto.

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

0

¿Cómo intentas crear un elemento "nuevo"? tenga en cuenta que cada id solo se puede usar una vez por página. tiene que ser único. de lo contrario, el código js usará la primera id que encuentre.

https://www.w3schools.com/html/html_id.asp

es posible que deba volver a escribir su código para usar la clase o algo como esto:

 var initWords = function (element) { const symbols = ['God', 'Words']; let count = 0; const iteration = () => { element.innerHTML = symbols[parseInt(count / 2, 10) % symbols.length]; if (count % 2 !== 0) { element.classList.add("LANGUAGE"); } else { element.classList.remove("LANGUAGE"); } count++; if (count === symbols.length * 2) { count = 0; } }; let inthandle = setInterval(iteration, 270); iteration(); } initWords(document.getElementById("WORD1")); initWords(document.getElementById("WORD2"));
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!