skrollr-menu icon indicating copy to clipboard operation
skrollr-menu copied to clipboard

Fix for opening url with hash and scrolling webpage to correct place.

Open adamlukaszczyk opened this issue 12 years ago • 8 comments

While opening page with hash function handleLink() was fired before skroll.menu.init(), so _skrollrInstance.setScrollTop(top) throw an error.

adamlukaszczyk avatar Jul 06 '13 22:07 adamlukaszczyk

Good catch.

Could you explain that last commit? How is it related?

Prinzhorn avatar Jul 07 '13 10:07 Prinzhorn

Hello @Prinzhorn. Have you tried this changes ?

adamlukaszczyk avatar Jul 18 '13 20:07 adamlukaszczyk

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.

Prinzhorn avatar Jul 22 '13 08:07 Prinzhorn

Your fix is working for me @dobiatowski => thank you (even in FF).

ghost avatar Jul 27 '13 06:07 ghost

@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?

ajohnh avatar Aug 01 '13 23:08 ajohnh

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.

Prinzhorn avatar Aug 13 '13 08:08 Prinzhorn

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

Prinzhorn avatar Oct 13 '13 11:10 Prinzhorn

@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.

neufeind avatar Oct 30 '14 20:10 neufeind