-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunction.js
60 lines (51 loc) · 1.94 KB
/
function.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
//sticky nav bar function
window.onscroll = function(){stickyNavbar()};
function stickyNavbar(){
let navbar = document.getElementById('navbar')
if(window.pageYOffset > 0){
navbar.style.position = "fixed";
navbar.style.top = "0"
} else{
navbar.style.position= "relative"
navbar.style.top=""
}
}
// click and scroll down into section function
function scrollToSection(sectionId){
var section = document.getElementById(sectionId)
section.scrollIntoView({behavior:'smooth'})
}
// vertical nav bar in aboutme
const experienceButton = document.querySelector('.navbar-skill-button-experience')
const experienceInfo = document.querySelector('.experience')
const educationButton = document.querySelector('.navbar-skill-button-education')
const educationInfo = document.querySelector('.education')
const skillButton = document.querySelector('.navbar-skill-button-skill')
const skillInfo = document.querySelector('.skill')
educationButton.addEventListener("click",()=>{
if(experienceInfo.classList.contains('show-education')){
experienceInfo.classList.remove('show-education')
}
if(skillInfo.classList.contains('show-education')){
skillInfo.classList.remove('show-education')
}
educationInfo.classList.toggle('show-education')
})
experienceButton.addEventListener("click",()=>{
if(educationInfo.classList.contains('show-education')){
educationInfo.classList.remove('show-education')
}
if(skillInfo.classList.contains('show-education')){
skillInfo.classList.remove('show-education')
}
experienceInfo.classList.toggle('show-education')
})
skillButton.addEventListener("click",()=>{
if(educationInfo.classList.contains('show-education')){
educationInfo.classList.remove('show-education')
}
if(experienceInfo.classList.contains('show-education')){
experienceInfo.classList.remove('show-education')
}
skillInfo.classList.toggle('show-education')
})