0

So I have a page that displays a list of 100 items. How would I be able to store the item that is being scrolled to in the URL, so that the user can control which item is scroll to in the URL?

www.site.com/inventory?scroll_position=67
Heretic Monkey
  • 11,687
  • 7
  • 53
  • 122

1 Answers1

1

Include a tag at the text you wish to scroll to:

<a name="scroll_position=67"></a>

The url needs to read: www.myawesomesite.com/inventory#67

When the page loads run the following javascript:

function scrollTo(hash)
{
 location.hash='#'+hash;
}
sanepete
  • 979
  • 9
  • 28