Bundle page-specific JavaScript

This commit is contained in:
Helen Chong 2024-07-18 23:36:07 +08:00
parent bdb693d73d
commit 27d39ffc0c
3 changed files with 6 additions and 6 deletions

View File

@ -35,7 +35,7 @@
}
{% endcss %}
<script>
{%- js %}
const hero = document.querySelector(".hero");
const heroTopBarEl = document.querySelector(".hero__top-bar");
const headerImgEl = document.querySelector(".hero__img");
@ -43,4 +43,4 @@
{% block eventScript %}
{{ eventScript }}
{% endblock %}
</script>
{% endjs %}

View File

@ -133,7 +133,7 @@ https://kalechips.net/projects/snippets/burger #}
}
{% endcss %}
<script>
{%- js %}
const navbarBurger = document.querySelector(".navbar__burger");
navbarBurger.addEventListener("keydown", (event) => {
if (event.key == "Escape") {
@ -142,4 +142,4 @@ https://kalechips.net/projects/snippets/burger #}
document.querySelector(".navbar__toggle").focus();
}
});
</script>
{% endjs %}

View File

@ -12,7 +12,7 @@
{%- css %}#statuscafe-content { margin-bottom: 0.5em; }{% endcss %}
<script>
{%- js %}
const statusCafeContent = document.getElementById("statuscafe-content");
statusCafeContent.innerHTML = `
<p>Fetching data from status.cafe...</p>
@ -36,4 +36,4 @@
}
};
fetchStatusCafe();
</script>
{% endjs %}