Skip to content
This repository was archived by the owner on Dec 17, 2024. It is now read-only.

Files

Latest commit

2615c78 · Jul 17, 2023

History

History

HoverPrefetch

🚀  Astro — URLs prefetching on hover

NPM Downloads ISC License PRs Welcome
Astro TypeScript Prettier EditorConfig ESLint

This component capture mouse hovering on links with internal URLs.
Then, it will prefetch the HTML document beforehand.

The goal is to make further page loading snappier.
It's useful with SSG but also with SSR in certain scenarios.

It plays well with this page transition component:
astro-page-transition

📦  Installation

pnpm i astro-hover-prefetch

🛠  Usage

---
import { HoverPrefetch } from 'astro-hover-prefetch';
// ...
---
<!-- ... -->
<head>
  <!-- Place component inside `HEAD` tag -->

  <!-- 'max' property is optional -->
  <HoverPrefetch max={8} />

  <!-- ... -->
</head>