index-website-static/assets/js/onload.js
Julie Blanc 53b6355baf
All checks were successful
Deploy / Deploy to pre-production (push) Successful in 8s
add fonts
2025-12-19 12:33:59 +01:00

51 lines
1.1 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//TEMP, with includeHTML() --------------------------------------
window.onload = async function () {
await runIncludeHTML();
initAfterLoad();
};
function runIncludeHTML() {
if (typeof includeHTML === "function") {
const result = includeHTML();
if (result instanceof Promise) {
return result;
}
}
return Promise.resolve();
}
/// INIT--------------------------------------------------------
// Note: une fois que IncludeHTML() est supprimé, on peut supprimer tout le temp au dessus
// remplacer `function initAfterLoad()` par ↓
// window.onload = async function () {
function initAfterLoad() {
headerToggle();
}
// ===============================
// HEADER
// ===============================
function headerToggle() {
const header = document.getElementById("site-header");
const buttonToggle = document.querySelector("#menu-toggle");
console.log(header);
console.log(buttonToggle);
if (!header || !buttonToggle) return;
buttonToggle.addEventListener("click", () => {
document.body.classList.toggle("menu-open");
});
}