Relative Content

Tag Archive for javascripthtmlcssdomappendchild

Childrens of a div separated before dropping in the grid

I want the red pieces’ children to be draggable and droppable onto the grid. Specifically, I want the pieces to be dropped separately. For example, when I drag redPiece5 and drop it onto a grid, not all pieces should go onto a single grid cell. Instead, I want them to be divided separately. When I drag and drop it, the middle piece should go to the place where I drop it, and the two elements should go to the grid pieces before it and the other two pieces should go after it. I also don’t want the pieces dragged one by one in pieces. I want the pieces to add as a child to the grid piece. Later I will replace the pieces with an image.