Skip to content
New issue

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

Changing DOM order after drag and drop #154

Open
Gleb-Tocarenco opened this issue Mar 26, 2014 · 6 comments
Open

Changing DOM order after drag and drop #154

Gleb-Tocarenco opened this issue Mar 26, 2014 · 6 comments

Comments

@Gleb-Tocarenco
Copy link

it is possible to change DOM elements after changing their location with packery?

@desandro
Copy link
Member

Here's an example that uses Draggabilly and changes the order once it's been 'dropped' http://codepen.io/chriscoyier/pen/BvcKq

It was written up in CSS Tricks!

http://css-tricks.com/draggable-elements-push-others-way/


+1 this issue if you would like to see this feature added to Packery.

@jcdsr
Copy link

jcdsr commented Oct 17, 2014

There is a bug on your code,

http://codepen.io/desandro/pen/cbhDG

When you drag the "first" item to the "last one" the DOM doesn't change and error in console appear.

Do you have any ideas? I'm really struggling to find the error.

I will appreciate all your help

@desandro
Copy link
Member

Good catch, fixed! http://codepen.io/desandro/pen/cbhDG

@jcdsr
Copy link

jcdsr commented Oct 21, 2014

The other issue I have is if I have like 40 or 60 items long on the page, the page doesn't scroll with the item I'm dragging. Like if push item 40th to 1st on the top. Make sense

@desandro
Copy link
Member

@carlosdv4 Yes. I've documented that feature request in desandro/draggabilly#1

@dbockenfeld
Copy link

@desandro Thanks for the code, but I notice that your code is only for one-dimensional identically shaped DOM elements. How would it work for a two-dimensional grid with elements of varying size?

In this case some elements are moved to fill in space, but the DOM doesn't get updated for those elements that are automatically moved. How would you modify the DOM for those automatically moved elements?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants