Skip to content
This repository has been archived by the owner on Jan 24, 2018. It is now read-only.

hash tag supplied not scrolled to when landing on the page, fix included #12

Open
Blatant opened this issue Jul 24, 2013 · 9 comments
Open

Comments

@Blatant
Copy link

Blatant commented Jul 24, 2013

Currently when the skrollr js file is included, the url is parsed for hash tags and if skrollr is initialised issues the command to scroll to said id/name element.

However if like me you initialise the skrollr on document.ready (so you can do things like set dynamic key frames and position elements off the stage (right or bottom) skrollr is not initialised when the js file is loaded/parsed, and hence the command to scroll to the named anchor is ignored (you end at the top of the page each time thanks to the scrollTo(0,0) command).

I would suggest modifying as per 👍

What I did first is locate the final function wrapped in a defer, which has had the if(document.querySelector)...statement remmed out, leaving the scrollTo(0,0) intact to stop the standard 'straight to hash' intact.

I then moved the entire function wrapped in the function (in the defer) to the end of skrollr.menu.init and remmed out the scrollTo(0,0). Now it works fine and dandy for me, and animates the scroll to the hash supplied after skrollr is initialised.

@kidwm
Copy link

kidwm commented Aug 29, 2013

I encountered this problem, too.

@kara-todd
Copy link

I also had this problem... I found changing line 176 from handleLink(link, true); to handleLink(link, false); fixed it for me.

Not sure if this is the correct behavior?

@laltaffer
Copy link

I tried changing line 176 but found no difference in the behavior

@laltaffer
Copy link

Blatant - what do you mean 'remmed out' ? Its not a term I'm familiar with

Could you paste your final code?

@Prinzhorn
Copy link
Owner

Please try version 0.1.6. It should work on mobile as well.

@tslatt
Copy link

tslatt commented Feb 3, 2015

Blatant - I also don't understand what you mean. Could you paste your final code?

@Blatant
Copy link
Author

Blatant commented Feb 3, 2015

Hi tslatt,

It's been a long time and the site I used this on has since shut down, so I'm afraid I can't find the code again.

However if you see Prinzhorn's latest comment, it should be working now. Try giving the latest version a go, it would be my first port of call.

FYI: when I say "Remmed out" I simply meant "comment out the code" or just delete the line mentioned.

@tslatt
Copy link

tslatt commented Feb 3, 2015

It's not fixed in the latest version. But commenting out the defer function seems to fix the issues. Thanks!

@Blatant
Copy link
Author

Blatant commented Feb 3, 2015

Glad I was able to help a little bit :)

Sorry I couldn't supply the code itself though. If I ever get the chance (work load) I'll see if I can retrieve the code form my Source Control and I'll copy it back here.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants