100-project-100-days-website/js/main.js

49 lines
1.6 KiB
JavaScript
Raw Normal View History

2022-08-26 14:52:43 +03:00
// Toggle Menu
function menuToggle(){
const menuToggle = document.getElementById('menuToggle');
const navigation = document.getElementById('navigation');
menuToggle.classList.toggle('active');
navigation.classList.toggle('active');
};
2022-09-16 22:58:37 +03:00
// Countdown Done !!
2023-02-22 13:56:30 +03:00
// const body = document.body;
// const endTime = new Date('2 21 2023 23:59:59');
// const daysEl = document.getElementById('days');
// const hoursEl = document.getElementById('hours');
// const minutesEl = document.getElementById('minutes');
// const secondsEl = document.getElementById('seconds');
2022-08-24 22:36:39 +03:00
2023-02-22 13:56:30 +03:00
// setInterval(updateCountdown, 1000)
2022-08-24 22:36:39 +03:00
2023-02-22 13:56:30 +03:00
// 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;
// };
2022-08-24 22:36:39 +03:00
2022-08-26 14:52:43 +03:00
// Time & Date (Footer)
2022-08-25 12:28:12 +03:00
setInterval(function(){
document.getElementById('date').innerHTML = Date();
},1000);
2022-09-16 22:58:37 +03:00
// Scroll To Top
2022-08-24 22:36:39 +03:00
let scrollTop = document.querySelector('.scrollTop');
window.onscroll = function (){
this.scrollY >= 1000 ? scrollTop.classList.add('show') : scrollTop.classList.remove('show');
};
scrollTop.onclick = function(){
window.scrollTo({
top: 0,
behavior:'smooth'
});
2022-08-25 12:28:12 +03:00
};