您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Prevent scrolling issues when page is resized by loading images
当前为
// ==UserScript== // @name Smart scrolling // @namespace [email protected] // @description Prevent scrolling issues when page is resized by loading images // @include * // @version 1.1 // @grant none // ==/UserScript== (function() { var images = [].slice.call(document.getElementsByTagName('IMG')); var imagesHeight = []; var imagesParent = []; (function() { var style; for(var i = 0; i < images.length; i++) { if(!images[i].offsetParent || getComputedStyle(images[i]).position == 'fixed') { images.splice(i--, 1); } else { imagesParent[i] = images[i]; while(true) { imagesParent[i] = imagesParent[i].parentNode; if(imagesParent[i] == document.body) break; style = getComputedStyle(imagesParent[i]); if(style.overflow == 'auto' || style.overflow == 'scroll') break; } } } })(); if(images.length == 0) return; var update = function() { var rect, height; for(var i = 0; i < images.length; i++) { rect = images[i].getBoundingClientRect(); height = Math.round(rect.bottom - rect.top); if(!isNaN(imagesHeight[i]) && imagesHeight[i] != height && rect.bottom < 0) { if(imagesParent[i] == document.body) scrollBy(0, height - imagesHeight[i]); else imagesParent[i].scrollTop += height - imagesHeight[i]; } imagesHeight[i] = height; } requestAnimationFrame(update); }; update(); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址