Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

285
Vistas
addEventListener touchstart y touchend no funcionan

El script funciona como se esperaba en una PC, pero no sucede nada en la versión móvil.

¿Cómo puedo hacer que funcione para que un deslizamiento hacia la izquierda o hacia la derecha mueva el div en consecuencia?

Más cosas aquí para que pueda enviar todo el código.

 document.addEventListener("touchstart", touchStart, false); document.addEventListener("touchend", touchEnd, false); document.addEventListener("mousedown", touchStart, false); document.addEventListener("mouseup", touchEnd, false); var xDown = null; var yDown = null; function touchStart(event) { xDown = event.clientX; yDown = event.clientY; } function touchEnd(event) { var currentPlayerPosition = parseInt(window.getComputedStyle(playerModel, null).getPropertyValue('left')); if ( ! xDown || ! yDown ) { return; } var xUp = event.clientX; var yUp = event.clientY; var xDiff = xDown - xUp; var yDiff = yDown - yUp; if ( Math.abs( xDiff ) > Math.abs( yDiff ) ) { if ( xDiff > 0 ) { if(currentPlayerPosition <= "25") { return; } document.getElementById("playerModel").style.left = currentPlayerPosition - 25 + "px"; } else { if(currentPlayerPosition >= "230") { return; } document.getElementById("playerModel").style.left = currentPlayerPosition + 25 + "px"; } } else { if ( yDiff > 0 ) { } else { } } xDown = null; yDown = null; }
about 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda