We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
https://codepen.io/Ibishka/pen/YzJYLZV
The text was updated successfully, but these errors were encountered:
let dragStartItems; const grid = new Muuri(".grid", { dragEnabled: true, layout: { fillGaps: true }, dragSortPredicate: (item) => { const result = Muuri.ItemDrag.defaultSortPredicate(item); if (result) { if (result.index === 6) { return false; } } return Muuri.ItemDrag.defaultSortPredicate(item); } }) .on("dragStart", () => { dragStartItems = grid.getItems(); }) .on("dragReleaseEnd", (item) => { // You must use dragReleaseEnd instead of dragEnd, to sort correctly // You must sort, because sometimes return incorrect order const sortedGridItems = grid.getItems().sort((a, b) => { const aPos = a.getPosition(); const bPos = b.getPosition(); return aPos.top - bPos.top || aPos.left - bPos.left; }); const itemIndex = sortedGridItems.indexOf(item); const prevItem = dragStartItems[itemIndex].getElement(); if (Number(prevItem.dataset.index) !== 6) { return; } const itemPrevIndex = dragStartItems.indexOf(item); grid.move(item, itemPrevIndex, { layout: "instant" }); });
for those, who want solution. But this should fixed from core
Sorry, something went wrong.
@niklasramo Any progress on that?
No branches or pull requests
https://codepen.io/Ibishka/pen/YzJYLZV
Recording.2023-05-05.223433.mp4
The text was updated successfully, but these errors were encountered: