Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
_frog
· 12y ago · 0 comments
I really liked Discourse's approach to infinite scrolling[1], it updates the URL as you go with the History API's replaceState() function so you can safely navigate away from the page without losing your position.
[1]:
http://eviltrout.com/2013/02/16/infinite-scrolling-that-work...
Comments
[–]
yeukhon
12y ago
Also, visually, the up page# down could be shown on the right hand side. [
http://try.discourse.org/t/discussion-happens-so-much/127/98
] and with a bigger font. that's more clear. putting it in the bottom is hard to read.
[–]
jonshariat
12y ago
If you look at the URL bar in google's example it does that as well.
[–]
prawks
12y ago
The difference is that Discourse does it on a per-item basis, Google's on a per-page. A small implementation detail.
[–]
navs
12y ago
Well with discourse you want to go to a very specific comment in the thread so doing it per item is best. But that's not for every use case.
[–]
Flimm
12y ago
The difference is that it doesn't break the back button! Clicking back takes me back to HN, not back a page.
[–]
berns
12y ago
It's not without problems though. It breaks the incremental find in chrome. When the URL changes, the find dialog gets closed.
[–]
rplnt
12y ago
Wouldn't it be better to use anchors? It is the same page after all... now you'll end up with thousands of duplicit entries in your history.
[–]
_frog
OP
12y ago
Not quite, the replaceState() function, as its name would imply, replaces a history item instead of creating a new one.
[–]
rplnt
12y ago
Oh, I missed that it does that.