fix: modal event listener on page transition
This commit is contained in:
parent
a3cf31b112
commit
d51e578caa
1 changed files with 7 additions and 1 deletions
|
@ -27,7 +27,7 @@ import Layout from "../layouts/Layout.astro";
|
||||||
</Layout>
|
</Layout>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
document.getElementById("discord-btn").onclick = function () {
|
function discordOnClick () {
|
||||||
const modal: any = document.getElementById("discord-modal")
|
const modal: any = document.getElementById("discord-modal")
|
||||||
modal.showModal();
|
modal.showModal();
|
||||||
let inp: any = document.getElementById("discord-inp")!;
|
let inp: any = document.getElementById("discord-inp")!;
|
||||||
|
@ -35,4 +35,10 @@ document.getElementById("discord-btn").onclick = function () {
|
||||||
inp.select();
|
inp.select();
|
||||||
document.execCommand("copy");
|
document.execCommand("copy");
|
||||||
}
|
}
|
||||||
|
document.onload = function () {
|
||||||
|
document.getElementById("discord-btn").onclick = discordOnClick;
|
||||||
|
}
|
||||||
|
document.addEventListener("astro:page-load", function () {
|
||||||
|
document.getElementById("discord-btn").onclick = discordOnClick;
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue