详情介绍

要开启Chrome浏览器的实验性平滑滚动功能,可以按照以下步骤操作:
1. 打开Chrome浏览器。
2. 点击右上角的菜单按钮(三个垂直点),然后选择“更多工具”。
3. 在弹出的菜单中,找到并点击“开发者工具”选项。
4. 在开发者工具中,点击左侧的“Console”选项卡。
5. 在控制台窗口中,输入以下代码:
javascript
document.addEventListener('DOMContentLoaded', function() {
const smoothScroll = document.createElement('div');
smoothScroll.style.position = 'fixed';
smoothScroll.style.top = '0';
smoothScroll.style.left = '0';
smoothScroll.style.width = '100%';
smoothScroll.style.height = '100`;
smoothScroll.style.backgroundColor = 'f9f9f9';
smoothScroll.style.zIndex = '9999';
document.body.appendChild(smoothScroll);
smoothScroll.style.overflowX = 'hidden';
smoothScroll.style.overflowY = 'scroll';
smoothScroll.style.transition = 'all 0.5s ease-out';
smoothScroll.style.pointerEvents = 'none';
smoothScroll.style.position = 'absolute';
smoothScroll.style.top = '0';
smoothScroll.style.left = '0';
smoothScroll.innerHTML = div style="height: 100px; width: 100px; background-color: red;">
smoothScroll.style.display = 'flex';
smoothScroll.style.justifyContent = 'center';
smoothScroll.style.alignItems = 'center';
smoothScroll.style.marginLeft = '-100px';
smoothScroll.style.transform = 'translateX(100px)';
smoothScroll.style.transformOrigin = '0 0';
smoothScroll.style.opacity = '0';
smoothScroll.style.transition = 'opacity 0.5s ease-in';
smoothScroll.style.pointerEvents = 'auto';
smoothScroll.style.visibility = 'hidden';
smoothScroll.style.zIndex = '10000';
smoothScroll.style.position = 'absolute';
smoothScroll.style.top = '0';
smoothScroll.style.left = '0';
smoothScroll.style.width = '100%';
smoothScroll.style.height = '100%';
smoothScroll.style.backgroundColor = 'transparent';
smoothScroll.style.boxShadow = '0 0 10px rgba(0, 0, 0, 0.5)';
smoothScroll.style.cursor = 'default';
smoothScroll.style.overflowX = 'hidden';
smoothScroll.style.overflowY = 'scroll';
smoothScroll.style.position = 'absolute';
smoothScroll.style.top = '0';
smoothScroll.style.left = '0';
smoothScroll.style.width = '100%';
smoothScroll.style.height = '100%';
smoothScroll.style.backgroundColor = 'rgba(0, 0, 0, 0)';
smoothScroll.style.pointerEvents = 'none';
smoothScroll.style.visibility = 'visible';
smoothScroll.style.opacity = '1';
smoothScroll.style.transition = 'opacity 0.5s ease-in';
smoothScroll.style.pointerEvents = 'auto';
smoothScroll.style.visibility = 'visible';
});
5. 按F12键打开开发者工具,然后在控制台窗口中运行上述代码。
6. 等待代码执行完成,你会发现鼠标上下滑动时不再出现顿挫感。