Infinite Ajax Scroll
  • Overview
  • Installation
  • Getting started
  • License
  • Support
  • Reference
    • Options
    • Methods
    • Events
  • Advanced
    • Triggers
    • Last page message
    • History
    • Overflow
    • Upward scroll
Powered by GitBook
On this page
  • Updating url and title
  • Loading previous pages

Was this helpful?

  1. Advanced

History

PreviousLast page messageNextOverflow

Last updated 2 years ago

Was this helpful?

Updating url and title

When users are scrolling through pages we can update the browser url and page title. This allows the current page to be shared or bookmarked.

We can achieve this by listening for the event. The page event contains the url and title of the current page in view.

The can be used to update the url.

ias.on('page', (event) => {
  // update the title
  document.title = event.title;

  // update the url
  let state = history.state;
  history.replaceState(state, event.title, event.url);
});

Loading previous pages

Infinite Ajax Scroll can also be used to load items above the current scroll position. This is useful when you want to load older items first.

page
History API
View this behaviour in a live demo
View upwards infinite scroll documentation