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

139
Vistas
Drag position issue with event touch move on touch screen

I have implemented drag and drop with html/JavaScript. It works well with mouse drag but having issue with touch screen. while dragging item on touch screen it's position is not correct either it goes up or down from the touch point. Thanks in advance!

var _left = _touch.clientX;
var _top = _touch.clientY;
_touch.target.style.left = _left + 'px';
_touch.target.style.top = _top + 'px';
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

The issue has been resolved. The fix is as below:

var droppable = document.elementFromPoint(_touch.clientX, _touch.clientY);
var _left = _touch.clientX - droppable.getBoundingClientRect().left;
var _top = _touch.clientY - droppable.getBoundingClientRect().top;
_touch.target.style.left = _left + 'px';
_touch.target.style.top = _top + 'px';

I am getting the droppable container's left and top and subtracting it from draggable item.

about 4 years ago · Juan Pablo Isaza Denunciar
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