diff --git a/assets/javascripts/discourse/components/rewind.gjs b/assets/javascripts/discourse/components/rewind.gjs index 6a4b43c..b06eb73 100644 --- a/assets/javascripts/discourse/components/rewind.gjs +++ b/assets/javascripts/discourse/components/rewind.gjs @@ -58,6 +58,19 @@ export default class Rewind extends Component { } } + @action + handleScroll() { + window.addEventListener("scroll", () => { + let parent = document.getElementById("div.rewind"); + let children = parent.getElementsByClassName(".parallax-bg"); + for (let i = 0; i < children.length; i++) { + children[i].style.transform = `translateY(-${ + (window.pageYOffset * i) / children.length + }px)`; + } + }); + } +