parallax works : )

This commit is contained in:
Jordan Vidrine 2025-01-03 10:40:06 -06:00
parent 5b916dcf1c
commit bf79dc2512
2 changed files with 6 additions and 6 deletions

View File

@ -61,9 +61,9 @@ export default class Rewind extends Component {
@action
handleScroll({ target }) {
let children = this.rewindContainer.getElementsByClassName("parallax-bg");
for (let i = 1; i < children.length; i++) {
for (let i = 0; i < children.length; i++) {
children[i].style.transform = `translateY(-${
(target.scrollTop * i) / children.length
(target.scrollTop * (i + 1)) / 5
}px)`;
}
}

View File

@ -39,19 +39,19 @@
.background-1 {
background: url(/plugins/discourse-rewind/images/bg-1.png);
background-size: cover;
background-size: contain;
position: absolute;
transform: translateY(0px);
width: 100%;
height: 100%;
height: 1000%;
}
.background-2 {
position: absolute;
width: 100%;
height: 100%;
height: 1000%;
background: url(/plugins/discourse-rewind/images/bg-2.png);
background-size: cover;
background-size: contain;
transform: translateY(0px);
}