I'm applying ScrollSmoother site-wide in my main.js (in the head of my HTML) by doing this:
var smoother =ScrollSmoother.create({
smooth:2,
effects:true,
normalizeScroll:true,//prevents overscrolling});
Then on timeline.html i have specific code to create jump links that references the (which I thought was global) smoother var within a `<script></script>` just above my site footer:
//make scrollto buttons (jump links don't work otherwise)[...document.querySelectorAll('#timeline-sub-nav a, a[data-jumplink]')].forEach(function(item){
item.addEventListener('click',function(e){
e.preventDefault();
smoother.scrollTo(item.hash,false,"top -100px");
smoother.scrollTo(item.hash,true);});
I'm getting a ReferenceError: Can't find variable: smoother
This was working before when I had the ScrollSmoother only on this page
Also as an aside - it was my experience that hash/jumplinks (`site.html/#timeline1`) don't work with ScrollSmoother without using scrollTo - is that right?
Reference ScrollSmoother object
in GSAP
Posted
Hi There,
I'm applying ScrollSmoother site-wide in my main.js (in the head of my HTML) by doing this:
Then on timeline.html i have specific code to create jump links that references the (which I thought was global) smoother var within a `<script></script>` just above my site footer:
I'm getting a ReferenceError: Can't find variable: smoother
This was working before when I had the ScrollSmoother only on this page
Also as an aside - it was my experience that hash/jumplinks (`site.html/#timeline1`) don't work with ScrollSmoother without using scrollTo - is that right?