Wikipedia Smooth Scroll

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

Autor
Daniel Bronshtein
Instalaciones diarias
0
Instalaciones totales
2
Calificaciones
0 0 0
Versión
0.2
Creado
26/03/2025
Actualizado
27/03/2025
Tamaño
1.56 KB
Licencia
MIT
Funciona en

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