scrimba
Note at 2:52
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

AboutCommentsNotes
Note at 2:52
Expand for more info
index.js
run
preview
console
// javascript
let g = document.querySelector(".gallery")
let n = document.querySelector(".next")
let p = document.querySelector(".previous")
let x = 0

p.addEventListener("click", () => {
if (x < 0) {
x = x + 220;
}

g.style.transform = `translate(${x}px)`
});


n.addEventListener("click", () => {
if (x > -880) {
x = x - 220;
}

g.style.transform = `translate(${x}px)`
});
Console
/index.html
LIVE