-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscripts.js
57 lines (50 loc) · 1.42 KB
/
scripts.js
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
function show(proj) {
let deets = document.querySelector(`#${proj}Deets`);
deets.classList.add("is-visible-deets");
}
function hideDetails(proj) {
let deets = document.querySelector(`#${proj}Deets`);
deets.classList.remove("is-visible-deets");
}
function showHamburger() {
let menu = document.querySelector("nav");
menu.classList.toggle("is-visible");
}
function pageLoad() {
let handleTouchShow = function(e) {
e.preventDefault();
show(e.target.id);
console.log(e.target.id);
};
let details = document.getElementsByClassName("deets");
let deetArr = Array.from(details);
deetArr.map(item => {
item.addEventListener("touchstart", handleTouchShow, false);
item.addEventListener("click", e => {
e.preventDefault();
show(item.id);
});
});
let handleTouchHide = function(e) {
e.preventDefault();
hideDetails(e.target.id);
console.log(hamburg);
};
let hide = document.getElementsByClassName("hide");
let hideArr = Array.from(hide);
hideArr.map(item => {
item.addEventListener("touchstart", handleTouchHide, false);
item.addEventListener("click", e => {
e.preventDefault();
hideDetails(item.id);
});
});
let handleTouchHam = function(e) {
e.preventDefault();
console.log(hamburg);
showHamburger();
};
let hamburg = document.getElementById("ham");
hamburg.addEventListener("touchstart", handleTouchHam, false);
}
pageLoad();