Update main.js

This commit is contained in:
Sam 2022-09-16 22:58:37 +03:00 committed by GitHub
parent 34be6273f9
commit 9a9915c2f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,36 +6,35 @@ function menuToggle(){
navigation.classList.toggle('active');
};
// Countdown
// Countdown Done !!
// const body = document.body;
// const endTime = new Date('9 16 2022 23:59:59');
// const daysEl = document.getElementById('days');
// const hoursEl = document.getElementById('hours');
// const minutesEl = document.getElementById('minutes');
// const secondsEl = document.getElementById('seconds');
const body = document.body;
const endTime = new Date('9 16 2022 23:59:59');
const daysEl = document.getElementById('days');
const hoursEl = document.getElementById('hours');
const minutesEl = document.getElementById('minutes');
const secondsEl = document.getElementById('seconds');
// setInterval(updateCountdown, 1000)
setInterval(updateCountdown, 1000)
function updateCountdown() {
const startTime = new Date();
const diff = endTime - startTime;
const days = Math.floor(diff / 1000 / 60 / 60 / 24);
const hours = Math.floor(diff / 1000 / 60 / 60) % 24;
const minutes = Math.floor(diff / 1000 / 60) % 60;
const seconds = Math.floor(diff / 1000) % 60;
daysEl.innerHTML = days;
hoursEl.innerHTML = hours < 10 ? '0'+hours : hours;
minutesEl.innerHTML = minutes < 10 ? '0'+minutes : minutes;
secondsEl.innerHTML = seconds < 10 ? '0'+seconds : seconds;
};
// function updateCountdown() {
// const startTime = new Date();
// const diff = endTime - startTime;
// const days = Math.floor(diff / 1000 / 60 / 60 / 24);
// const hours = Math.floor(diff / 1000 / 60 / 60) % 24;
// const minutes = Math.floor(diff / 1000 / 60) % 60;
// const seconds = Math.floor(diff / 1000) % 60;
// daysEl.innerHTML = days;
// hoursEl.innerHTML = hours < 10 ? '0'+hours : hours;
// minutesEl.innerHTML = minutes < 10 ? '0'+minutes : minutes;
// secondsEl.innerHTML = seconds < 10 ? '0'+seconds : seconds;
// };
// Time & Date (Footer)
setInterval(function(){
document.getElementById('date').innerHTML = Date();
},1000);
// scroll To Top
// Scroll To Top
let scrollTop = document.querySelector('.scrollTop');
window.onscroll = function (){