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) {
|
div.onclick = function (e) {
|
||||||
if (clickedBlock) {
|
if (clickedBlock) {
|
||||||
if (clickedArea != dat) {
|
if (clickedArea != dat) {
|
||||||
|
let next1 = clickedBlock.nextSibling;
|
||||||
|
let next2 = div.nextSibling;
|
||||||
|
|
||||||
let p = clickedBlock.parentElement;
|
let p = clickedBlock.parentElement;
|
||||||
div.parentElement.appendChild(clickedBlock);
|
div.parentElement.insertBefore(clickedBlock,next2);
|
||||||
p.appendChild(div);
|
p.insertBefore(div,next1);
|
||||||
|
|
||||||
let swap = {};
|
let swap = {};
|
||||||
console.log(clickedArea, dat)
|
console.log(clickedArea, dat)
|
||||||
|
|
Loading…
Reference in a new issue