Jump to content
GreenSock

Dennyno

Scroll to top buggy values

Go to solution Solved by Dennyno,

Recommended Posts

Hi guys.
I did this circle scroller counter, but I don't know why on my website https://staging11.whynot/media/unlock the rotation doesn't follow the scrolling on desktop (while on mobile works well).

But the main problem (not related to the rotation of my staging site, which of course if out of the scope and I'll try to resolve myself - even if I cant understand the reason of the bug) is that the scroll value goes more than 100%. Actually 101~102%... any idea please?

Also also the scrollto plugin (to achieve the smooth scroll top onclick) , even on the demo seems not working at all...

Am I missing something? Tx 

See the Pen gOXGMpx by DedaloD (@DedaloD) on CodePen

Link to comment
Share on other sites

Your site's not working, and I have no idea why the percent would be more than 100%.

 

But I would just animate the percent kind of like this.

 

See the Pen MWOERoK by GreenSock (@GreenSock) on CodePen

 

And I don't know why the ScrollToPlugin isn't working in your demo, but you have a crazy ton of CSS in there that I have no clue as to what it's doing. That said, the plugin does work just fine here.

 

See the Pen gOXGyZJ by GreenSock (@GreenSock) on CodePen

 

  • Like 1
Link to comment
Share on other sites

  • Solution

Hi Blake!
Solved both problems.
 

EDIT: wrong url: https://staging11.whynot.media/unlock
The wrapper was an <a> tag, so I'd needed to put a preventDefault to prevent default click action.
Now I changed to a simple div and works smoothly.

The problem Is that my percentage scrolls till 101~120 % on some pages.

How can I put a maximum value? (Also is strange that the value is higher than the 100/100 of the height) :P

(Sorry for not posting on codepen this issue, dont know how to replicate) 

 

Link to comment
Share on other sites

Solved swapping from 

document.body.scrollHeight

To:

document.documentElement.scrollHeight


✌️

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×