1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
const div_Photo = document.querySelector('.photo');
const div_Center = document.querySelector('.center');
const listeSections = document.querySelectorAll('.middle .header div a');
const langue = typeLangue.value;
// pour faire afficher par défaut cette section au moment arriver sur la page
function affichageAccueuil(){
if (langue === "fr"){
$(div_Center).load("/pageAccueuil/partie_accueuil.html");
} else if (langue === "en"){
$(div_Center).load("../pageAccueuil/partie_accueuil_EN.html");
}
} // cette fonction marche
// Affichage de la section du menu centrale du haut dans le div du centre
function affichageSection(){
$(listeSections).each(function(){
$(this).on('click', function(evt){
evt.preventDefault();
if (evt.target.href === "http://localhost:8080/english/english.html"){
window.location.assign("/english/english.html");
} else if (evt.target.href === "http://localhost:8080/index.html"){
window.location.assign("/index.html");
} else if (evt.target.href === "http://localhost:8080/pageAccueuil/partie_photos.html" || evt.target.href === "http://localhost:8080/pageAccueuil/partie_photos_EN.html"){
$(div_Center).load(evt.target.href);
affichageSectionPhoto();
} else {
$(div_Center).load(evt.target.href);
$(div_Photo).append("");
}
});
});
} // cette fonction marche
// à corriger !!!!!!!!!!!!!!!!!!!!!
function affichageSectionPhoto(){
const listePassions = document.querySelectorAll('.middle .center .header .unePassionPhoto a'); // J'ai utilisé le même principe qu'à la fct précédente, mais on dirait que je ne déclare pas mes choses comme il faut
$(listePassions).each(function(){
$(this).on('click', function(e){
e.preventDefault();
console.log(e);
$(div_Photo).load(e.href);
});
});
}
document.addEventListener('DOMContentLoaded', function(event) {
affichageAccueuil();
affichageSection();
}); |
Partager