-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
87 lines (78 loc) · 2.82 KB
/
app.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
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
const menuBtn = document.querySelector('.open-menu');
const menu = document.querySelector('.menu');
const aboutBtn = document.querySelector('#about-btn').firstChild;
const projBtn = document.querySelector('#proj-btn').firstChild;
const servicesBtn = document.querySelector('#services-btn').firstChild;
menuBtn.addEventListener('click', () =>{
menu.classList.toggle('open');
changeBtn();
changeRef();
})
function changeBtn(){
if (menuBtn.src == "https://img.icons8.com/ios-glyphs/30/menu--v1.png"){
menuBtn.src = "https://img.icons8.com/ios/30/delete-sign--v1.png"
} else {
menuBtn.src = "https://img.icons8.com/ios-glyphs/30/menu--v1.png"
}
}
function changeRef(){
aboutBtn.href = "about.html"
projBtn.href = "projects.html"
servicesBtn.href = "services.html"
}
var path = window.location.pathname;
var page = path.split("/").pop();
const mobileHome = document.querySelector('#section1')
const mobileAbout = document.querySelector('#about')
const mobileProj = document.querySelector('#projects')
const mobileServices = document.querySelector('#services')
function displaySection(x){
if(x.matches){
if(page == 'index.html'){
if(mobileAbout.style.display == ''){
mobileAbout.style.display = 'none';
}
if(mobileProj.style.display == ''){
mobileProj.style.display = 'none';
}
if(mobileServices.style.display == ''){
mobileServices.style.display = 'none';
}
}
if(page == 'about.html'){
if(mobileHome.style.display == ''){
mobileHome.style.display = 'none';
}
if(mobileProj.style.display == ''){
mobileProj.style.display = 'none';
}
if(mobileServices.style.display == ''){
mobileServices.style.display = 'none';
}
}
if(page == 'projects.html'){
if(mobileHome.style.display == ''){
mobileHome.style.display = 'none';
}
if(mobileAbout.style.display == ''){
mobileAbout.style.display = 'none';
}
if(mobileServices.style.display == ''){
mobileServices.style.display = 'none';
}
}
if(page == 'services.html'){
if(mobileHome.style.display == ''){
mobileHome.style.display = 'none';
}
if(mobileAbout.style.display == ''){
mobileAbout.style.display = 'none';
}
if(mobileProj.style.display == ''){
mobileProj.style.display = 'none';
}
}
}
}
var x = window.matchMedia("(max-width: 425px)");
displaySection(x);