Open armandocomellas1 opened 2 years ago
Also you will need to calculate the position between each container for that you can use this piece of code:
function getDragAfterElement(container, y) { const draggableElements = [...container.querySelectorAll('.draggable:not(.dragging)')]; return draggableElements.reduce((closest, child) => { const box = child.getBoundingClientRect(); const offset = y - box.top - box.height / 2;
if (offset < 0 && offset > closest.offset) { return { offSet: offset, element: child, }; } return closest;
}, { offset: Number.NEGATIVE_INFINITY }).element;
Good luck and great work!
Great job so far but l have some recommendations fo you:
Also you will need to calculate the position between each container for that you can use this piece of code:
function getDragAfterElement(container, y) { const draggableElements = [...container.querySelectorAll('.draggable:not(.dragging)')]; return draggableElements.reduce((closest, child) => { const box = child.getBoundingClientRect(); const offset = y - box.top - box.height / 2;
}, { offset: Number.NEGATIVE_INFINITY }).element;
Good luck and great work!