I stumbled across this blog post by Wes Hatch on their implementation of a “scroll-jacking” / forced scrolling. The effect is shown on and the blog post is here
I’ve tried to implement this effect, but when I do I get an error:
Uncaught ReferenceError: scrollThreshold is not defined
This either occurs on line 12 or line 22 of the JS, depending on if you try and scroll up or down. I really like the effect and want to mess around with it, but I can’t figure out how to get it working. I tried adding
var scrollThreshold = 500;
and a few different numbers other than 500, which removed the console error but still didn’t actually fix/do anything in terms of getting the scroll to function.
I really like the functionality of the site and I’d love to get it to work, but my javascript is quite poor and I’m pretty stuck at the moment. I searched the live source code of hugeinc's javascript files but I couldn't find any reference to the term scrollThreshold. Any help would be great!
Here is a codepen:
PS: There are some replies of other people have issues on github, but no reply from hugeuser as of yet
I stumbled across this blog post by Wes Hatch on their implementation of a “scroll-jacking” / forced scrolling. The effect is shown on http://www.hugeinc. and the blog post is here http://www.hugeinc./ideas/perspective/scroll-jacking-on-hugeinc
I’ve tried to implement this effect, but when I do I get an error:
Uncaught ReferenceError: scrollThreshold is not defined
This either occurs on line 12 or line 22 of the JS, depending on if you try and scroll up or down. I really like the effect and want to mess around with it, but I can’t figure out how to get it working. I tried adding
var scrollThreshold = 500;
and a few different numbers other than 500, which removed the console error but still didn’t actually fix/do anything in terms of getting the scroll to function.
I really like the functionality of the site and I’d love to get it to work, but my javascript is quite poor and I’m pretty stuck at the moment. I searched the live source code of hugeinc.'s javascript files but I couldn't find any reference to the term scrollThreshold. Any help would be great!
Here is a codepen: http://www.codepen.io/patrickwc/pen/HAoJl
PS: There are some replies of other people have issues on github, but no reply from hugeuser as of yet https://gist.github./hugeuser/9095183
It looks like your scrollThreshold value is too big. The appropriate value for scrolling should be about 20 - 30. Here is the codepen that showing how it works: http://codepen.io/anon/pen/KJupc/ Hope this help.
the js on the original site is heavily obfuscated, i've been struggling myself with scrollThreshold value from the explanation example, until I found this part
function ft(i) {
...
if (r--, Math.abs(r) >= k)
....
},
where k is set to 5, so scrollThreshold=5, and delta is 0. thus it started working