-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
47 lines (39 loc) · 1.35 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
39
40
41
42
43
44
45
46
47
// Slider
// let slides = document.querySelectorAll(".slide");
// const slider = document.querySelector(".slider");
// slider.style.transform = "scale(.2)";
// slider.style.overflow = "hidden";
// // Cloned slides
// let firstSlide = slides[0];
// let lastSlide = slides[slides.length - 1];
// let cloneFirst = firstSlide.cloneNode(true);
// let cloneLast = lastSlide.cloneNode(true);
// // Connect cloned slides to slider
// slider.appendChild(cloneFirst);
// slider.insertBefore(cloneLast, firstSlide);
// let curSlide = 0;
// let maxSlides = slides.length;
// slides = document.querySelectorAll(".slide");
// maxSlides = slides.length;
// slides.forEach((slide, i) => (slide.style.transform = `translateX(${100 * i}%)`));
// const changeSlide = function () {
// curSlide++;
// if (curSlide === maxSlides) {
// curSlide = 0;
// }
// slides.forEach((slide, i) => (slide.style.transform = `translateX(${100 * (i - curSlide)}%)`));
// };
// const changeSlide = function () {
// curSlide++;
// if (curSlide === maxSlides) {
// slider.style.transition = "none";
// curSlide = 0;
// setTimeout(() => {
// slider.style.transition = "";
// }, 0);
// }
// slides.forEach((slide, i) => (slide.style.transform = `translateX(${100 * (i - curSlide)}%)`));
// };
// setInterval(() => {
// changeSlide();
// }, 3000);