-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscript.js
60 lines (56 loc) · 1.72 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
48
49
50
51
52
53
54
55
56
57
58
59
60
function arrow() {
var leftArrow = document.querySelector(".ri-arrow-left-line");
var rightArrow = document.querySelector(".ri-arrow-right-line");
var container = document.querySelector("#container");
rightArrow.addEventListener("click", function () {
container.style.transform = "translatex(-752px)";
container.style.gridTemplateColumns = "23vw 23vw 23vw 23vw 23vw 23vw";
container.style.marginLeft = "30px";
});
leftArrow.addEventListener("click", function () {
container.style.transform = "translatex(0px)";
container.style.gridTemplateColumns = "23vw 23vw 23vw 25vw 23vw 23vw";
container.style.marginLeft = "0";
});
}
arrow();
function SaleScroll() {
let lArrow = document.querySelector(".ri-arrow-left-s-line");
let RArrow = document.querySelector(".ri-arrow-right-s-line");
let image = document.querySelectorAll("#pics");
let counter = 0;
lArrow.addEventListener("click", function () {
if (counter <= image.length && counter > 0) {
--counter;
imageslide();
carinfo();
}
});
RArrow.addEventListener("click", function () {
if (counter < image.length - 1) {
counter++;
imageslide();
carinfo();
console.log(counter);
}
});
function imageslide() {
image.forEach((pics) => {
pics.style.transform = `translateX(${counter * -305}px)`;
});
}
function carinfo() {
let infos = document.querySelectorAll(".info");
infos.forEach((info) => {
info.style.transform = `translateY(${counter * -440}px)`;
});
}
}
SaleScroll();
function disableScroll() {
let number = document.querySelector("#phone");
number.addEventListener("wheel.disableScroll", function (e) {
e.preventDefault();
});
}
disableScroll();