-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapp.js
27 lines (24 loc) · 839 Bytes
/
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
//imp! NAVBAR SCROLLING COLOR
window.onscroll = () => {
if(scrollY > 233){
document.querySelector('.header-section').style.backgroundColor = '#1b1514e7';
}
else if (scrollY === 0){
document.querySelector('.header-section').style.backgroundColor = 'transparent';
}
}
//imp! COUNTER UP JAVASCRIPT
let valueDisplays = document.querySelectorAll(".section-5__counter-number");
let interval = 5000;
valueDisplays.forEach((valueDisplay) => {
let startValue = 0;
let endValue = parseInt(valueDisplay.getAttribute("data-val"));
let duration = Math.floor(interval / endValue);
let counter = setInterval(function () {
startValue += 1;
valueDisplay.innerHTML =`${startValue}<span class="plus-symbol">+</span>`;
if (startValue == endValue) {
clearInterval(counter);
}
}, duration);
});