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

127
Views
¿Es posible disparar eventos de mouse sin movimientos de mouse en safari?

Estoy tratando de poner eventos de entrada / salida del mouse en elementos móviles. Hay un problema al manejar el evento de desplazamiento con CSS, así que estoy tratando de procesarlo con JS. Esto funciona bien en Chrome pero no funciona en Safari. ¿Cómo hacer que mouseenter/mouseleave funcione correctamente cuando el mouse está detenido?

CSS

 .big-box { position: relative; width: 500px; height: 100px; background: #ee9; } .hit-box { position: absolute; top: 0; left: 0; width: 100px; height: 100px; background: #e99; }

HTML

 <div class="big-box"> <div class="hit-box">hit-box</div> </div>

JavaScript

 const hitbox = document.querySelector('.hit-box'); var position = 5; hitbox.style.left = 0; hitbox.addEventListener('mouseenter', function() { console.log('enter'); }); hitbox.addEventListener('mouseleave', function() { console.log('leave'); }); setInterval(function() { if(parseInt(hitbox.style.left) + position > 400) { position = -5; } else if(parseInt(hitbox.style.left) + position < 0) { position= 5; } hitbox.style.left = parseInt(hitbox.style.left) + position + 'px'; },20)
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!