export function timerGD() {
let timeGD = new Date("Mar 8 2023 00:00:00");
const timer = () => {
let now = new Date();
let getLeft = timeGD - now;
const titleNY = "Eigth March";
const zero = "0";
let days = Math.floor(getLeft / 1000 / 60 / 60 / 24);
let hours = Math.floor(getLeft / 1000 / 60 / 60) % 24;
let minutes = Math.floor(getLeft / 1000 / 60) % 60;
let seconds = Math.floor(getLeft / 1000) % 60;
if (days < 10) days = zero + days;
if (hours < 10) hours = zero + hours;
if (minutes < 10) minutes = zero + minutes;
if (seconds < 10) seconds = zero + seconds;
document.querySelector(".title-big").textContent = titleNY;
document.querySelector(".timer-days__days").innerHTML = days;
document.querySelector(".timer-hours__hours").innerHTML = hours;
document.querySelector(".timer-minutes__minutes").innerHTML = minutes;
document.querySelector(".timer-seconds__seconds").innerHTML = seconds;
};
if(!GD) {
clearInterval(cl);
return;
}
timer();
const cl = setInterval(timer, 1000);
}
let NY=true;
let GD=true;
let IU=true;
switches.addEventListener("click", (event) => {
if (event.target.id == "NY") {
timerNY();
console.log(1);
GD=false
IU=false
} else {
//?
}
if (event.target.id == "GD") {
timerGD();
console.log(2);
NY=false
IU=false
} else {
//?
}
if (event.target.id == "IU") {
timerIU();
GD=false
NY=false
} else {
//?
}
});
Делаю $ npm install swiper
<link rel="stylesheet" href="https://unpkg.com/swiper@8/swiper-bundle.min.css" />
<script type="module">
import Swiper from 'https://unpkg.com/swiper@8/swiper-bundle.esm.browser.min.js'
const swiper = new Swiper(...)
</script>