From 66b9043665f85a3180d91a63d7cbacd82493c16b Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Sun, 22 Sep 2024 15:03:56 +0800 Subject: feat(CSS): use class name to hide draggable block --- src/Layout.mjs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/Layout.mjs') diff --git a/src/Layout.mjs b/src/Layout.mjs index 0c992d7..2deef01 100644 --- a/src/Layout.mjs +++ b/src/Layout.mjs @@ -91,7 +91,7 @@ export class Overlay extends Layout { // Close button draggableBlock.querySelector('#close').onclick = () => { - draggableBlock.setAttribute("data-state", "hide") + draggableBlock.classList.add('hide') } // Plus/Minus font-size of content draggableBlock.querySelector('#plus-font-size').onclick = () => { @@ -107,11 +107,11 @@ export class Overlay extends Layout { const utils = draggableBlock.querySelector('.utils') draggableInstance.onDragStart = () => { utils.style.opacity = 0 - draggableBlock.setAttribute('data-state', 'on-drag') + draggableBlock.classList.add('drag') } draggableInstance.onDragEnd = () => { utils.style = '' - draggableBlock.removeAttribute('data-state') + draggableBlock.classList.remove('drag') } // Reposition draggable instance when resized -- cgit v1.2.3-70-g09d2