-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain-script.js
More file actions
21 lines (19 loc) · 777 Bytes
/
main-script.js
File metadata and controls
21 lines (19 loc) · 777 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
window.onscroll = function() {
var scrollDistance = window.scrollY;
for(paragraph of document.getElementsByClassName("paragraph")){
if(paragraph.offsetTop <= Math.ceil(scrollDistance)){
const menuItems = document.getElementsByClassName('menu-item');
for(menuItem of menuItems) {
menuItem.classList.remove("active");
const href = menuItem.getAttribute("href");
if(href.slice(1,href.length)===paragraph.id){
menuItem.classList.add('active');
}
}
}
}
};
function onSendClick(){
document.getElementById("contactForm").classList.add("visible");
document.getElementById("contactQuestion").classList.add("hidden");
}