-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
97 lines (87 loc) · 2.93 KB
/
Copy pathindex.html
File metadata and controls
97 lines (87 loc) · 2.93 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#FFFFFF" />
<meta name="description" content="Web site created using create-react-app"/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo.png" />
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Ubuntu:wght@400;700&display=swap" rel="stylesheet">
<title>RJ Nkosi</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script>
window.onload = function(){
// els.addEventListener('click',function(){
// closeMenuLayer()
// })
window.onscroll = () => {
//this section deals with scrolling of the page
let nav = document.getElementsByClassName('navbar')[0]
let back = document.getElementsByClassName('back-to-top')[0]
if (nav) {
if (document.documentElement.scrollTop > 250) {
nav.classList.add('nav-scroll')
back.classList.remove('hide-top')
} else {
nav.classList.remove('nav-scroll')
back.classList.add('hide-top')
}
}
//this deals with the changing of the nav link class after page section detection
let menuSection = document.querySelectorAll('.nav-link')
let mainSection = document.querySelectorAll('.container-fluid');
mainSection.forEach((v, i) => {
let rect = v.getBoundingClientRect().y
if (rect < window.innerHeight - 200) {
menuSection.forEach(v => v.classList.remove('active'))
menuSection[i].classList.add('active')
}
})
}
}
function handleLinkClick(e){
var els = document.querySelectorAll('.menu-layer ul li a')
for (let i = 0; i < els.length; i++) {
els[i].classList.remove('active')
}
e.target.classList.add('active')
closeMenuLayer()
}
function closeMenuLayer(){
const menu_layer = document.getElementsByClassName('mobile-menu')[0]
menu_layer.classList.add('hide-menu-layer')
}
</script>
<div class="mobile-menu hide-menu-layer">
<span class="close-menu" onclick="closeMenuLayer()">×</span>
<div class="menu-layer">
<ul>
<li class="">
<a class="active" href="#header" onClick="handleLinkClick(event)">Home</a>
</li>
<li class="">
<a class="" href="#about" onClick="handleLinkClick(event)">About</a>
</li>
<li class="">
<a class="" href="#skills" onClick="handleLinkClick(event)">Skills</a>
</li>
<li class="">
<a class="" href="#portfolio" onClick="handleLinkClick(event)">Porfolio</a>
</li>
<li class="">
<a class="" href="#contact" onClick="handleLinkClick(event)">Contact</a>
</li>
</ul>
</div>
</div>
<div class="back-to-top hide-top">
<a href="#header">↑</a>
</div>
</body>
</html>