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

Details

SPAish allows you to remember which <details> elements were open and restore their state across page loads.

How To Use

Add the script to your page and call reopen with a unique page key and selectors:

<script src="https://cdn.jsdelivr.net/npm/@wolframkriesing/spaish@1.0.5/_dist/spaish.min.js"></script>
<script>
  spaish.details.reopen('my-page-key', [
    '#faq-section',
    '.collapsible-info',
    '[data-details]'
  ]);
</script>

This will:

Example HTML

<details id="faq-section">
  <summary>Frequently Asked Questions</summary>
  <p>Content that will remember if it was expanded...</p>
</details>

<details class="collapsible-info">
  <summary>More Information</summary>
  <p>This state is also preserved...</p>
</details>

Storage

Open states are stored in sessionStorage using the provided page key:

Cross-Page State

Using the same page key across multiple pages allows restoring state even when the URL changes:

// Use the same key on all documentation pages
spaish.details.reopen('docs-menu', ['#navigation-menu', '.sidebar-sections']);

This is useful for maintaining expanded menu states across multiple documentation pages or any site with shared navigation elements.

Important Notes