muuri
muuri copied to clipboard
Retrieve the position of hidden grid items in custom layout function
First of all, thanks for all your hard work!
I'm trying to create a custom layout function (of type LayoutFunction
) but having trouble retrieving the position of items before they were hidden.
Please take a look at the following example:
- A grid has three visible items. My layout function receives an array of them (type
Item[]
as its third argument) and places them according to the function's logic. - I hide one item. The layout function is invoked. The array of items has only two items.
- Now, I show the hidden item. The array of three items is passed as an argument to the layout function. But the previously hidden item has a position
{left: 0, top: 0}
for some reason.
My question is, how do I place it where it was before hiding? Could you show an example of a custom layout besides the one in the documentation?