Closed ivodolenc closed 5 years ago
Glad you like it! How about moving the scrollToHello
inside the click function? Instead of getting the top position once, just get the right value on click and no matter how many time you resize your window, once you click it will return the right value.
var siteBtn = document.querySelector('.site-btn');
sitekBtn.addEventListener('click', function(event) {
var scrollToHello = document.querySelector('.hello').offsetTop;
TweenLite.to(smooth.vars, 0.7, {
target: scrollToHello,
ease: Expo.easeInOut
});
});
Yeah, that rocks! Thanks for super fast response , I appreciate it. 👍
Hey man, thanks for this awesome lib! 👌
I use it in my new portfolio and everything works great, but I've noticed a little problem with the scrollTo function.
After resizing the window, scrollTo links to the wrong position. I'm guessing that the problem is with caching top point (el.offsetTop) of resized section, it needs an update.
This is my current code:
...and later on
Again, this works great, but after resizing it links to the wrong position. How can I solve this, do you have some idea? 🤔