fix node insertion bug
This commit is contained in:
parent
5e81cc5e2e
commit
f4e81e9511
1 changed files with 5 additions and 2 deletions
|
@ -50,9 +50,12 @@ async function createBlocks(dat) {
|
|||
div.onclick = function (e) {
|
||||
if (clickedBlock) {
|
||||
if (clickedArea != dat) {
|
||||
let next1 = clickedBlock.nextSibling;
|
||||
let next2 = div.nextSibling;
|
||||
|
||||
let p = clickedBlock.parentElement;
|
||||
div.parentElement.appendChild(clickedBlock);
|
||||
p.appendChild(div);
|
||||
div.parentElement.insertBefore(clickedBlock,next2);
|
||||
p.insertBefore(div,next1);
|
||||
|
||||
let swap = {};
|
||||
console.log(clickedArea, dat)
|
||||
|
|
Loading…
Reference in a new issue