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

309
Views
Mi animación js scroll no funciona, veo muchos ',' esperados ts (1005) y (las anotaciones de tipo solo se pueden usar en archivos mecanografiados)

Estoy siguiendo un tutorial y estoy cerca del final, ¿mi animación de desplazamiento no parece funcionar? ¿Alguien podría señalar si tengo algún error con mi javascript ya que soy bastante nuevo?

https://www.youtube.com/watch?v=afaqr875gUE&t=486s (en caso de que te preguntes cuál era el tutorial)

código:

 document.lastScrollPosition = 0; document.lastCentered = 0; document.onWayTo = null; document.addEventListener('scroll', listener: () => { const direction = window.pageYOffset - document.lastScrollPosition > 0 'down' : 'up'; const sections = [...document.querySelectorAll('selection')]; if(document.onWayTo === null) { const destIndex = direction === 'up' ? document.lastCentered - 1 : document.lastCentered + 1; if(destIndex >= 0 && destIndex < sections.length) { console.log({destIndex,direction}); document.onWayTo = destIndex; window.scroll(x: 0, sections[destIndex].offsetTop); } } sections.forEach((section,index : number) => { if(window.pageYOffset === section.offsetTop) { document.lastCentered = index; section.className = 'action'; if (document.onWayTo === index) { document.onWayTo = null; } } else{ section.className = ''; } }) document.lastScrollPosition = window.pageYOffset; })
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!