From 1ce828080fd0fcf12298738163ba6028de1f8c85 Mon Sep 17 00:00:00 2001 From: Jordan Vidrine Date: Fri, 3 Jan 2025 09:42:42 -0600 Subject: [PATCH] more --- .../javascripts/discourse/components/rewind.gjs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) 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)`; + } + }); + } +