-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
106 lines (88 loc) · 3.46 KB
/
Copy pathmain.js
File metadata and controls
106 lines (88 loc) · 3.46 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
document.addEventListener("DOMContentLoaded", function () {
//window.scrollTo({ top: 0, behavior: "smooth" });
let clickable = "mouseover";
//slider
const cards = document.querySelectorAll(".card");
cards.forEach((card) => {
card.addEventListener("click", function () {
document.querySelector(".focused").classList.remove("focused");
card.classList.toggle("focused");
});
});
//formation slide
const formations = [...document.querySelectorAll(".formation")];
const formationName = document.querySelector(".formation-container-name");
const desc = [...document.querySelectorAll(".formation-description")];
if ("ontouchstart" in formations[0]) {
clickable = "click";
}
let index = undefined;
formations.forEach((formation) => {
formation.addEventListener(clickable, function transition() {
if (index !== undefined) {
desc[index].classList.remove("slide-right");
formations[index].classList.remove("formation-modifier");
}
formationName.classList.add("desactived-display");
desc[formations.indexOf(formation)].classList.add("slide-right");
index = formations.indexOf(formation);
//soulignement
formation.classList.add("formation-modifier");
});
});
//passions slide
const passions = [...document.querySelectorAll(".passion")];
const passionName = document.querySelector(".passion-container-name");
const descPassion = [...document.querySelectorAll(".passion-description")];
let indexP = undefined;
passions.forEach((passion) => {
passion.addEventListener(clickable, function transition() {
if (indexP !== undefined) {
descPassion[indexP].classList.remove("slide-left");
passions[indexP].classList.remove("passion-modifier");
}
passionName.classList.add("desactived-display");
descPassion[passions.indexOf(passion)].classList.add("slide-left");
indexP = passions.indexOf(passion);
//soulignment
passion.classList.add("passion-modifier");
});
});
//Contact
document.querySelector("#linkedin").addEventListener("click", () => {
window.open("https://www.linkedin.com/in/clement-chaban/");
});
document.querySelector("#phone").addEventListener("click", () => {
document.location.href = "tel:+33604138589";
});
document.querySelector("#mail").addEventListener("click", () => {
document.location.href = "mailto:chaban.clement@gmail.com?subject=&body=";
});
//scroll
// const sections = [...document.querySelectorAll(".section")];
// let active = 0;
// let to = undefined;
// let date = undefined;
// let oldDate = undefined;
// document.addEventListener("wheel", function (e) {
// date = Date.now();
// console.log(e);
// if (date - oldDate > 500 || oldDate == undefined) {
// oldDate = date;
// if (e.deltaY > 0) {
// active++;
// if (active > sections.length - 1) active = sections.length - 1;
// to = sections[active].offsetTop;
// //sections[active].scrollIntoView(true);
// window.scrollTo({ top: to, behavior: "smooth" });
// } else {
// console.log("test");
// active--;
// if (active < 0) active = 0;
// to = sections[active].offsetTop;
// //sections[active].scrollIntoView(true);
// window.scrollTo({ top: to, behavior: "smooth" });
// }
// }
// });
});