skrollr-menu
skrollr-menu copied to clipboard
hash tag supplied not scrolled to when landing on the page, fix included
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 :+1:
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.
I encountered this problem, too.
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?
I tried changing line 176 but found no difference in the behavior
Blatant - what do you mean 'remmed out' ? Its not a term I'm familiar with
Could you paste your final code?
Please try version 0.1.6. It should work on mobile as well.
Blatant - I also don't understand what you mean. Could you paste your final code?
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.
It's not fixed in the latest version. But commenting out the defer function seems to fix the issues. Thanks!
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.