skrollr-menu
skrollr-menu copied to clipboard
Fix for opening url with hash and scrolling webpage to correct place.
While opening page with hash function handleLink() was fired before skroll.menu.init(), so _skrollrInstance.setScrollTop(top) throw an error.
Good catch.
Could you explain that last commit? How is it related?
Hello @Prinzhorn. Have you tried this changes ?
Sorry, I haven't. I'm busy with non-open source stuff. But I'll probably find a day in the next weeks which I can spend completely on skrollr.
Your fix is working for me @dobiatowski => thank you (even in FF).
@dobiatowski - Yes, this fix works wonderfully in FF and webkit browsers (thank you!), but seems to break in iOS Safari. Results in something like: https://github.com/Prinzhorn/skrollr/issues/104. Have you noticed this behavior or is it just on my end?
Have you noticed this behavior or is it just on my end?
That's the point here. skrollr doesn't do native scrolling on mobile, so you can't rely on any native hash behavior.
Please try version 0.1.6. It should work on mobile as well.
@Prinzhorn: I tried the current version and stumbled across a problem with popstate in certain cases with Firefox. Adding the check for: if (e.state) { before actually looking at the state and doing the defer-call to scroll to top (which would actually scroll to position 0 since there was no position found) solved the problem for me.
Those cases worked fine for me on other browsers. There seem to be cases when FF triggers the popstate which we might want to ignore. For me the problem was that one scroll happened that scrolled to the desired position and then the scroll here kicked in which scrolled to 0 (top). Since both might be defered (using a window.setTimeout) I wonder if they could maybe even overlap since they don't necessarily have a defined order or so.