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

133
Views
La API Simple Intersection Observer entra en un bucle de representación infinito

Tengo este observador simple que agrega y elimina clases según entry.isIntersecting. Todo funciona bien, excepto cuando se cambia el tamaño del puerto de visualización a un tamaño particular (este tamaño está relacionado con el umbral) el observador va a la entrada de conmutación de bucle infinito. Soy consciente de por qué sucede esto y de que probablemente sea una solución fácil, pero simplemente no puedo encontrarla.

 const stickyNavReveal = function(entries){ const [entry] = entries if(!entry.isIntersecting){ //add class for sticky navigation nav.classList.add('sticky'); toTop.classList.remove('hidden'); } else{ nav.classList.remove('sticky'); toTop.classList.add('hidden'); } } const headerObserver = new IntersectionObserver(stickyNavReveal, { root:null, rootMargin:'40px', threshold:[0.4] }) headerObserver.observe(header)
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!