Scroll-Jacking in full-screen javascript; scrollThreshold definition

I stumbled upon this Wes Hatch blog post about their implementation of "force scrolling" / force scrolling. The effect is shown on http://www.hugeinc.com , and the blog post is here http://www.hugeinc.com/ideas/perspective/scroll-jacking-on-hugeinc

Ive tried to implement this effect, but when I do this, I get an error:

Uncaught ReferenceError: scrollThreshold is not defined 

This either happens on line 12 or on line 22 of the JS, depending on whether you are trying to scroll up or down. I really like this effect and I want to talk to him, but I can’t figure out how to make it work. I tried adding

var scrollThreshold = 500;

and several different numbers, other than 500, that removed the console error, but still didn't actually fix / did anything in terms of getting the scroll for the function.

I really like the functionality of the site and Id love to make it work, but my javascript is pretty poor and Im pretty stuck right now. I was looking for javascript source code for huge sites, but I could not find a link to the term scrollThreshold. Any help would be great!

Here is the code: http://www.codepen.io/patrickwc/pen/HAoJl

PS: There are some other people's answers on github, but there is no answer from greatuser yet https://gist.github.com/hugeuser/9095183

+4
source share
3 answers

, scrollThreshold . 20-30. , , : http://codepen.io/anon/pen/KJupc/ .

+4

js , scrollThreshold ,

function ft(i) { 
  ...
  if (r--, Math.abs(r) >= k)
  ....
},

k 5, scrollThreshold = 5, delta - 0. ,

0

codepen. : codepen css scss , css " ".

, , main.js html-, .

0

Source: https://habr.com/ru/post/1529439/


All Articles