kombai / freewall

Freewall is a cross-browser and responsive jQuery plugin to help you create grid, image and masonry layouts for desktop, mobile, and tablet...
MIT License
1.85k stars 375 forks source link

Request functionality : insert items into the wall #232

Open llavayssiere opened 8 years ago

llavayssiere commented 8 years ago

It is possible to append or prepend items but i would want to insert items into the wall, at the right, at the left, above or below of a given item of the wall. All the items of the wall must be automatically rearranged after items insertion.

mord4z commented 8 years ago

wall.appendBlock(yourDataHere); wall.prependBlock(yourDataHere);

llavayssiere commented 8 years ago

Thank you for your reply but i don't want to add blocks at the end or at the beginning of the already diplayed blocks of the wall. I need to insert blocks INTO the wall after or before an existing given block displayed into the wall.

New functions could be like that : wall.appendBlock(blockID, yourDataHere); to insert new blocks into the wall after the block with ID BlockID wall.prependBlock(blockID, yourDataHere); to insert new blocks into the wall before the block with ID BlockID

For example, if my wall is composed with 6 blocks with ID 1, 2, 3, 4, 5 and 6, and i want to insert 2 new blocks with ID 7 and 8 after or before the block 3, the result of function wall.appendBlock(3, yourDataHere); would be 1, 2, 3, 7, 8, 4, 5, 6 and the result of function wall.prependBlock(3, yourDataHere); would be 1, 2, 7, 8, 3, 4, 5, 6.

It seems possible to add these new functionnalities ?

kombai commented 8 years ago

Hi llavayssiere, Please insert your block in to DOM by use jQuery first, then use freewall later. http://api.jquery.com/insertafter/ But for performance, freewall will auto assign id for each block. Best