Don't use :has for copy code animation

And move the main container to _general.scss
This commit is contained in:
daudix
2024-07-18 22:14:01 +03:00
parent 54c75f36a6
commit f72225103f
5 changed files with 34 additions and 31 deletions

View File

@ -41,21 +41,21 @@
container.appendChild(block);
button.addEventListener("click", async () => {
await copyCode(block, button);
await copyCode(block, header);
});
}
});
async function copyCode(block, button) {
async function copyCode(block, header) {
let code = block.querySelector("code");
let text = code.innerText;
await navigator.clipboard.writeText(text);
button.classList.add("active");
header.classList.add("active");
setTimeout(() => {
button.classList.remove("active");
header.classList.remove("active");
}, 800);
}
});