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

107
Views
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
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!