您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Universal smooth scrolling with improved performance and compatibility. (Exceptions on large sites)
当前为
The smooth scroll implementation uses a class-based architecture with three main components:
State Management
Event System
Animation System
// Example of delta calculation
let delta = event.deltaY;
if (event.deltaMode === 1) { // LINE mode
delta *= lineHeight;
} else if (event.deltaMode === 2) { // PAGE mode
delta *= viewportHeight;
}
Initial Calculation
const scrollAmount = pixels * (1 - smoothness);
const integerPart = Math.trunc(scrollAmount);
const fractionalPart = scrollAmount - integerPart;
Subpixel Accumulation
subpixels += fractionalPart;
let additionalPixels = Math.trunc(subpixels);
subpixels -= additionalPixels;
Actual Scroll Application
element.scrollTop += (integerPart + additionalPixels);
Frame Rate Management
Memory Management
CPU Usage
{
smoothness: 0.5, // Scroll smoothness (lower = smoother)
acceleration: 0.5, // Scroll acceleration factor
minDelta: 0.1, // Minimum scroll delta to process
maxRefreshRate: 240, // Maximum FPS limit
minRefreshRate: 30, // Minimum FPS limit
defaultRefreshRate: 60, // Default FPS when undetectable
debug: false // Enable debug logging
}
Modern Browsers: Full support
Partial Support:
Installation
// Install via userscript manager (e.g., Tampermonkey)
// Enable script in browser extension
Configuration
// Adjust settings for specific needs
smoothScroll.config.smoothness = 0.3; // Smoother
smoothScroll.config.acceleration = 0.7; // Faster
Debugging
// Enable debug mode
smoothScroll.config.debug = true;
// Check console for detailed logs
Custom Scroll Containers
// Add data-smooth-scroll attribute
<div data-smooth-scroll="true">
<!-- Scrollable content -->
</div>
Scroll Prevention
// Add no-smooth-scroll class
<div class="no-smooth-scroll">
<!-- Content with normal scrolling -->
</div>
Smooth Scroll Not Working
Performance Issues
Scrolling Conflicts
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址