GODRICH
#css-animation#button#loader#transition#scroll#dashboard#ui#design-trends

03Grid reflow — inverting pointer coordinates into row/column indices

Dividing the pointer's x and y by the grid's track width and row height yields column and row indices via integer division, which are then flattened back into the 1D order array for the splice. Clamping at the edges means dropping outside the grid still lands safely in the last cell.

Best forImage ordering, widget layout boards

CSS custom propertiesgetBoundingClientRecttransition
Grid reflow — inverting pointer coordinates into row/column indices
Open in a new tab

03 Grid reflow — inverting pointer coordinates into row/column indices — Measured area 21.295% · moving frames 12/23Original by GODRICH · SCSS and React ship in the zip · Drag to Reorder UI: 9 Lists, One Drop Index

The post this demo lives in

Drag to Reorder UI: 9 Lists, One Drop Index - preview of all 9 demosDrag to Reorder UI: 9 Lists, One Drop IndexDrag to reorder UI: Computing the drop index from pointer position reorders lists, kanban boards and grids -- with long- See all demos in this post

If you like this effect - similar demos