blob: 3a6c3e56ab33b6fabca8b0c98bf886e38235646b (
plain)
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
|
// ############################################################################
// # #
// # Description: JS utile un peu de partout #
// # #
// ############################################################################
// Site web utilisés pour JS:
// https://www.w3schools.com/js/default.asp
// https://stackoverflow.com/
// ****************************************************************************
// CHANGEMENT DE LANGUE
// ****************************************************************************
document.getElementById("navSelLang").addEventListener("change", () => {
document.getElementById("navFormLang").submit();
});
// ****************************************************************************
// TOGGLE UNE CLASSE SUR UN ELEMENT PARMIS PLUSIEURS IDENTIQUES
// ****************************************************************************
function show(parentId, element, id, className) {
let elements = document.getElementById(parentId).getElementsByTagName(element);
elements[id].classList.add(className);
for (i = 0; i < elements.length; i++) {
if (elements[i].id !== id) {
elements[i].classList.remove(className);
}
}
}
// ****************************************************************************
// AFFICHER LA BAR DE NAVIGATION
// ****************************************************************************
function showNavButtons() {
document.getElementsByTagName("nav")[0].classList.toggle("showNav")
// first-child à chaque fois
document.getElementsByTagName("header")[0].getElementsByTagName("a")[0].getElementsByTagName("i")[0].classList.toggle("navLinkClicked")
}
|