Wikipedia Smooth Scroll

Adds smooth scrolling for in-page links on Wikipedia and sister sites

Autor
Daniel Bronshtein
Denně instalací
0
Celkem instalací
2
Hodnocení
0 0 0
Verze
0.2
Vytvořeno
26. 03. 2025
Aktualizováno
27. 03. 2025
Size
1,6 KB
Licence
MIT
Spustit na

Wikipedia Smooth Scroll Userscript

A userscript that adds smooth scrolling to internal links on Wikipedia and its sister sites.

Features

  • 🚀 Buttery-smooth scrolling for all in-page links (#anchor links)
  • 🔄 Full support for browser history (back/forward buttons)
  • 🌐 Works across all Wikimedia Foundation sites:
    • Wikipedia
    • Wiktionary
    • Wikibooks
    • Wikiquote
    • Wikivoyage
    • Wikisource
    • Wikinews
    • Wikiversity
    • Wikifunctions
  • ✨ Handles dynamically loaded content
  • 🛠️ Pure JavaScript - no dependencies required

Installation

  1. Install a userscript manager:

  2. Click here to install:
    Install

Or manually copy the script from the repository and add it to your userscript manager.

How It Works

The script:

  1. Intercepts clicks on internal links
  2. Prevents the default "jump" behavior
  3. Animates smooth scrolling to the target element
  4. Handles edge cases like:
    • Special characters in anchor IDs

Technical Details

  • Uses scrollIntoView with behavior: 'smooth' for smooth animations
  • Manages URL state to prevent native browser jumping
  • Lightweight (less than 2KB without minification)

Possible Issues

  • Some extremely old browsers may not support the smooth animation (will fall back to instant scroll)

License

MIT License - Free to use and modify