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

296
Views
Javascript: handle drop position indicator between tiles in grid (and at end of row)

I'm trying out a tile reshuffle experience in n * 2 grid. Taking reference of snapshot attached, the tile can be placed before tile 1 for putting it at starting position in row 1, or between tile 1 and tile 2 for cases where user wish to push it at position 1-2 in row 1.

For inserting a tile between tile 2 (in row 1) and tile 4 (in row 2), user can hover over after tile 2 in grid, or before tile 4 in row 2. Need to add dotted line as placeholder in both cases.

I'm thinking of two approaches -

  1. Adding placeholder divs as drop-zones, and when draggable tile appears there we try to insert at that position. I need to add intermediate divs with drop-zones which I feel can be avoided.
  2. Make tiles as drop-zones, and show dotted line when tile overlap is detected. With interact.js I could detect drag-enter and drag-leave events for tile overlap in and out, but there is issue for end of row. Let's say we show placeholder "before" the tile on overlap, how would place it at the end of row 1.

I suspect this is solved issue with grid, I could not find any reference with UX libraries (ex: material-ui) for such in-place (with placeholder in-between tiles) draggable/swap tile/grid layouts. Any directions to think better can help.

Placeholder is shown as dotted vertical line

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!