generated from Templates_CodeFirst/templateHtmlCss
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.3 KiB
34 lines
1.3 KiB
// Fonction pour charger le contenu HTML
|
|
async function loadHTML(url, containerId) {
|
|
try {
|
|
const response = await fetch(url);
|
|
if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
|
|
const html = await response.text();
|
|
document.getElementById(containerId).innerHTML = html;
|
|
} catch (error) {
|
|
console.error('Error loading HTML:', error);
|
|
}
|
|
}
|
|
|
|
// Chargement des sections
|
|
document.addEventListener('DOMContentLoaded', async () => {
|
|
const sections = [
|
|
{ url: 'sections/header.html', id: 'header-container' },
|
|
{ url: 'sections/about.html', id: 'about-container' },
|
|
{ url: 'sections/skills.html', id: 'skills-container' },
|
|
{ url: 'sections/formation.html', id: 'formation-container' },
|
|
{ url: 'sections/experience.html', id: 'experience-container' },
|
|
{ url: 'sections/projects.html', id: 'projects-container' },
|
|
{ url: 'sections/testimonials.html', id: 'testimonials-container' },
|
|
{ url: 'sections/footer.html', id: 'footer-container' }
|
|
];
|
|
|
|
// Chargement parallèle des sections
|
|
await Promise.all(sections.map(section =>
|
|
loadHTML(section.url, section.id)
|
|
));
|
|
|
|
// Initialisation des scripts après le chargement du contenu
|
|
const event = new Event('sectionsLoaded');
|
|
document.dispatchEvent(event);
|
|
}); |