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>
|
||||
|
||||
<script>
|
||||
document.getElementById("discord-btn").onclick = function () {
|
||||
function discordOnClick () {
|
||||
const modal: any = document.getElementById("discord-modal")
|
||||
modal.showModal();
|
||||
let inp: any = document.getElementById("discord-inp")!;
|
||||
|
@ -35,4 +35,10 @@ document.getElementById("discord-btn").onclick = function () {
|
|||
inp.select();
|
||||
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>
|
||||
|
|
Loading…
Reference in a new issue