-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
38 lines (32 loc) · 1.09 KB
/
script.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
// Eable Disable Script
function enabledisable(element) {
console.log(element.style)
if (element.style.fill != "rgb(29, 185, 84)") {
element.style.setProperty('fill', '#1db954');
} else {
element.style.setProperty('fill', '#fff');
}
}
// Greeetngs Script
const greeting = document.getElementById("greeting");
const hour = new Date().getHours();
const welcomeTypes = ["Good morning", "Good afternoon", "Good evening"];
let welcomeText = "";
if (hour < 12) welcomeText = welcomeTypes[0];
else if (hour < 18) welcomeText = welcomeTypes[1];
else welcomeText = welcomeTypes[2];
greeting.innerHTML = welcomeText;
//Scrolling nav bar code
const nav=document.querySelector("#topNav");
const sectionOne=document.querySelector(".fw-bold");
const sectionOneOptions={};
const sectionOneObserver = new IntersectionObserver(function(entries , sectionOneObserver) {
entries.forEach(entry => {
if(!entry.isIntersecting){
nav.style.backgroundColor="black";
} else{
nav.style.backgroundColor="transparent";
}
})
} , sectionOneOptions);
sectionOneObserver.observe(sectionOne);