Closed johnfisherman closed 11 years ago
Yep, it's planned. Sounds easier than it is (pushstate, onpopstate, etc.).
Great, good to know. It is a standard-breaker, thus an important implementation.
That said, huge kudos for both skrollr and the plugin ecosystem!
I had a quick look at this is it not possible to add
window.location.hash = href.substr(1);
after the test to check if it is a hashlink? This fix will only work in IE8+ as far as I am aware so this might not be a viable option?
This will cause the browser to jump to said hash.
I have tried it my self and it simply changes without doing anything (tested in chrome and firefox) unless you can think of a browser that this will occur?
Tried it in FF and Chrome and it does what I said.
hmm ok bit odd not doing it on mine have tried a few different computers and IE7+
I've added the window.location.hash = href.substr(1); in the handleClick function and it works fine in almost all browsers except mobile safari... Well at least the back button on mobile works fine but no animation.
A mix between scroll.menu and this library would be awesome http://benalman.com/projects/jquery-bbq-plugin/
By the way, great job on skrollr!
I've added it to this line https://github.com/Prinzhorn/skrollr-menu/blob/master/src/skrollr.menu.js#L62 and the following happens when I try it
#awesome
jumps to it without animation150px before #wambo
jumps to #wambo
and then animates 150px
back.this happens in both Firefox and Chrome on Ubuntu.
Forgot to tell, i'm only using data-menu-top instead of anchors nav. Works better with my skrollr animation.
This way I have an anchor that works with the back button and animation that gets right where i want. But the back button doesn't anime on safari mobile.
I have done some further looking into this, when my items are easing in from the side it doesn't jump however, when scrolling downwards it does. seems very odd why to me personally
Hi This seems to be great enhancement. Isn't it as simple as adding just line after var scrollTarget = document.getElementById(href.substr(1)); ?
window.history.pushState(href, scrollTarget, href);
For modern browsers i assume. Or it's lack something a can't see? Which is possible - i'm a beginner.
For modern browsers i assume. Or it's lack something a can't see? Which is possible - i'm a beginner.
On first sight it might look like it's that simple (it's not that hard either).
But
popstate
in order to scroll to the correct position when the user uses the back buttonWas finally trying to get this implemented, but http://stackoverflow.com/questions/10742422/prevent-browser-scroll-on-html5-history-popstate
So basically it won't work the way I wanted it to.
Good stuff, Alex! Well done, and thanks for this.
When clicking on a menu entry, besides moving the viewport to the actual anchor, #anchor should also be added to the url, for future permalink reference.
Right?