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

109
Vistas
interactJS clone node and dynamically toggle snap

How can you toggle the snap functionality dynamically when a certain div is entered via Interact JS. I would like to enable snapping as soon as a div is entered and disabled as soon as someone leaves the div.

My current approach is in this sandbox but the CSS is broken (not sure how to fix that it is taken from here https://interactjs.io/docs/faq/#clone-target-draggable)

const snap = interact.modifiers.snap({
  targets: [interact.snappers.grid({ x: 30, y: 30 })],
  range: Infinity,
  relativePoints: [{ x: 0, y: 0 }]
});
snap.disable();
// on enter div -> snap.enable();

As you can maybe see in the picture, the divs are not really aligned when I enable/disable snap dynamically as their enter point seems different.

enter image description here

My goal is to correctly align them like here

enter image description here

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