Skip to content

Commit ac997c6

Browse files
committed
feat(JS): add eventListener() to slidingPart element
1 parent f31ca44 commit ac997c6

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

index.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ body {
4545
row-gap: 10px;
4646
padding: 10px;
4747
background-color: rgb(27 22 22 / 39%);
48+
transform: translateX(0px);
49+
transition: transform 2s;
50+
4851

4952
}
5053
.history-btn,
@@ -57,9 +60,10 @@ body {
5760
}
5861

5962
.sliding-part.slide {
60-
transform: translateX(-200px);
63+
transform: translateX(200px);
6164
transition: transform 2s;
6265

66+
6367
}
6468

6569
.screen {

index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
const btns = document.querySelectorAll("[data-value]");
22
let screen = document.querySelector("[data-screen]");
33
const historyBtn = document.querySelector(".history-btn");
4+
const slidingPart = document.querySelector(".sliding-part");
45
const operators = document.querySelectorAll("[data-operator]");
6+
57
const operatorRegex = /[\/*\-+]/;
68
const ZERO = 0;
79
const ZERO_DOT = '0.';
810
const history = [];
911

10-
console.log(historyBtn)
12+
console.log(slidingPart)
1113

1214

1315
historyBtn.addEventListener("click", () => {
16+
slidingPart.classList.toggle("slide")
1417
console.log("history btn")
1518
})
1619

0 commit comments

Comments
 (0)