-4

I have a page with a long list of search result set.

When clicking a result you are directed to a different page that show this specific item details.

What I want is when the user goes back on his browser, the window is located at the link he clicked. (Which might be lower because its a long page that loads more feed when you scroll down, like the Facebook news feed).

Any suggestions with PHP/JavaScript or other language?

Thanks.

Nat Naydenova
  • 771
  • 2
  • 12
  • 30
Shaniqwa
  • 1,924
  • 2
  • 17
  • 29
  • welcome to typescript, please take a moment to read the how to ask a good question guide. It will help people trying to help you. http://stackoverflow.com/help/how-to-ask – toskv Dec 25 '15 at 12:03
  • if what you want is programmatic control over the history you can have a look at the **history** api. http://www.w3schools.com/jsref/obj_history.asp – toskv Dec 25 '15 at 12:05
  • if what you want is to create a navigable history without actually navigating to another page you can have a look at the **location** api. http://www.w3schools.com/jsref/obj_location.asp – toskv Dec 25 '15 at 12:13

1 Answers1

0

This would be quite hard to achieve, since it goes against the whole idea of infinite-scrolling.

You could refer to that item's ID and then preload the set it's in, while ignoring the previous result sets. Like so:

Let's imagine your list of results consists of a total of 100 items. And you want only 10 new items to load each time the bottom of the page is reached. That would leave you with 10 sets (with 10 items each). Quite similar to normal pagination, actually. Now, if your itemID is 32 and you want to navigate right back to it, you can actually preload the list to show the 3rd result set by default (and you could even add option to scroll up or down to show the first two or the next result sets).

# result set 1: hidden
# result set 2: hidden
# result set 3:
    item 30
    item 31
    item 32
    item 33
    ...
    item 39
#result set 4: hidden

If you want both resultSet1 and resultSet2 to be visible as well, you'll have to apply some sort of a JavaScript window height calculation in order to place the 3rd set in the center of the screen.

But, like I said - this is probably too much work and it takes away from the UX. Either use normal pagination or leave the infinite-scrolling as is.

Nat Naydenova
  • 771
  • 2
  • 12
  • 30