___ ___ _____ _ ( _`\ ( _`\ ( _ ) _ ( ) | (_(_)| |_) )| (_) |(_) ___ | |__ `\__ \ | ,__/'| _ || |/',__)| _ `\ ( )_) || | | | | || |\__, \| | | | `\____)(_) (_) (_)(_)(____/(_) (_) A PicoSSG tool

spaish.scroll

API for storing and restoring scroll positions across page loads for both window and specific scrollable elements.

restore(pageKey [, otherNodeSelectors = []])

Stores current scroll positions before page unload and restores them on page load.

Parameters

Description

The function sets up two main behaviors:

Storage (on beforeunload)

Restoration (immediate)

DOM Requirements

Storage Details

Example

// Basic usage - window scroll only
spaish.scroll.restore('my-page');

// With additional scrollable elements
spaish.scroll.restore('docs-page', [
  '#sidebar',
  '.content-area',
  '[data-scrollable="true"]'
]);

// Cross-page state with same key
spaish.scroll.restore('shared-layout', ['#navigation']);

Error Handling

Browser Events

Performance Notes