Wikipedia Smooth Scroll

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

作者
Daniel Bronshtein
日安装量
0
总安装量
2
评分
0 0 0
版本
0.2
创建于
2025-03-26
更新于
2025-03-27
大小
1.6 KB
许可证
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

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址