DaniBr / Wikipedia Smooth Scroll

Published:

Version: 0.2+73a8e66 updated

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

Homepage: https://github.com/DaniBr/wikipedia-smooth-scroll

License: MIT

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

Rating: 0