Skip to content

Commit 92d2028

Browse files
authored
Restore homepage.js
1 parent 65f1aef commit 92d2028

File tree

1 file changed

+11
-24
lines changed

1 file changed

+11
-24
lines changed

homepage/homepage.js

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -174,35 +174,22 @@ checkPWA();*/
174174

175175
// add scroll event listeners
176176

177-
const screenHeight = window.innerHeight,
178-
featurePoints = document.querySelectorAll('#features .ftPoint'),
179-
180-
pointMargin = 34,
181-
startPointAnimation = (screenHeight / 3);
182-
183-
184-
let totalPointAnimation = startPointAnimation,
185-
pointStaggerIntervals = [];
177+
const screenHeight = window.innerHeight;
186178

187-
// set stagger intervals for feature points
188-
featurePoints.forEach(point => {
179+
const featurePoints = document.querySelectorAll('#features .ftPoint');
189180

190-
pointStaggerIntervals.push(totalPointAnimation);
181+
const startPointAnimation = screenHeight / 3;
182+
const pointStaggerInterval = 34 + (7 * 5);
191183

192-
totalPointAnimation += point.clientHeight;
193-
194-
});
195-
196-
197-
function checkPointAnimations() {
184+
function checkScrollAnimations() {
198185

199186
// window scroll position
200187
const scrolled = window.scrollY || window.pageYOffset;
201-
202-
// check feature point animation
188+
189+
// add staggered feature points animation
203190
featurePoints.forEach((point, index) => {
204-
205-
const pointAnimation = pointStaggerIntervals[index];
191+
192+
const pointAnimation = startPointAnimation + (pointStaggerInterval * index);
206193

207194
if (scrolled >= pointAnimation) {
208195
point.classList.add('visible');
@@ -215,5 +202,5 @@ function checkPointAnimations() {
215202
}
216203

217204

218-
window.addEventListener('scroll', checkPointAnimations);
219-
checkPointAnimations();
205+
window.addEventListener('scroll', checkScrollAnimations);
206+
checkScrollAnimations();

0 commit comments

Comments
 (0)