Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Anchor Links On Load #38

Closed
pangolingo opened this Issue Apr 8, 2013 · 5 comments

Comments

Projects
None yet
3 participants

SuperScrollorama sends the page back to the top when the init function is called. That means the url's anchor hash is ignored—the page won't jump to the correct position automatically.

Is this a bug, or is it standard behavior?

Owner

johnpolacek commented Apr 8, 2013

This is standard behavior. We could add a setting to disable it. For now you can comment out line 39:

// $('html, body').animate({ scrollTop: 0 }, 0);

An option to disable would be nice, unless it breaks something somewhere else. I assume you're doing the jump to the top for a good reason. I'll use your suggestion for now. Thanks.

Collaborator

janpaepke commented Apr 8, 2013

To my mind it is in the code, because up until recently superscrollorama didn't work if you would have jumped past a pin or animation using an anchor link. It might also be there to trigger the first position check.

I also stumbled over this line and I think it can be removed and "doUpdateOnNextTick" should be set to true from the start to init the first position check.

Collaborator

janpaepke commented Apr 10, 2013

I decided to remove this line from the code.
This line really has nothing to do what superscrollorama is supposed to do and so might be a surprising side-effect to people using it.
If the user wants to do a forced scroll to top at page load he should do it outside of superscrollorama.
If not superscrollorama calculates the correct animation and pin states/positions, even if the page is loaded with an anchor link or refreshed having scrolled down.
So there's really no reason to keep the line.

Hope you agree, @johnpolacek?

@janpaepke janpaepke closed this Apr 10, 2013

Owner

johnpolacek commented Apr 10, 2013

Works for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment