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

115
Views
WP Rocket hará que el evento de clic se active dos veces

Encuentro un problema extraño. Cuando habilite WP Rocket, la primera vez que haga clic en el menú en la versión móvil , el evento de clic se activará dos veces:

 function addEventListenerToElement(element, type, listener) { if (element) { element.addEventListener(type, listener); } } addEventListenerToElement(document.querySelector('.menu-toggle'), "click", function(event) { // Slide toggle main menu for mobile version DOMAnimations.slideToggle(document.querySelector('.mobile-nav'), 500); // Prevent the default action, such as follow a hyperlink event.preventDefault(); // Prevent the current event from further propagation to outer DOM nodes event.stopPropagation(); // 2021-10-21: The following return false can be commented out since: // 1. addEventListener callback function does not need to return a value, see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#the_event_listener_callback // 2. It is equivalent to event.preventDefault() + event.stopPropagation(). See https://stackoverflow.com/a/11184286/2704265 // We will not add comments for the following similar cases. // return false; });

Realizo la siguiente prueba:

  1. Cuando la página se carga por primera vez en el teléfono móvil y hago clic en el menú, el menú se deslizará hacia abajo y hacia arriba nuevamente. Y al agregar el punto de interrupción en DOMAnimations.slideToggle, encuentro que el evento se activa dos veces. La próxima vez que haga clic en el menú, el evento solo se ejecutará una vez.
  2. Si deshabilita WP Rocket, el evento solo se activará una vez.

¿Alguien ha encontrado problemas similares?

Actualizar

El sitio web con WP Rocket habilitado se puede encontrar en https://www.datanumen.com

El sitio web con WP Rocket deshabilitado se puede encontrar en http://www.sybase-recovery.com

Los dos sitios usan el mismo código JavaScript.

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!