Wikipedia Smooth Scroll

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

Автор
Daniel Bronshtein
Установок в день
0
Всего установок
2
Оценки
0 0 0
Версия
0.2
Создано
26.03.2025
Обновлено
27.03.2025
Размер
1,6 КБ
Лицензия
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

长期地址
遇到问题?请前往 GitHub 提 Issues。