这个滚到的位置我想再往上20px的位置怎样改? const intervalId = setInterval = let txt2imgGallery = documentbodyquerySelector#txt2img_gallery; if txt2imgGallery txt2imgGallerys
您可以使用 scrollBy() 方法将滚动位置向上移动 20px:
const intervalId = setInterval(() => {
let txt2imgGallery = document.body.querySelector("#txt2img_gallery");
if (txt2imgGallery) {
txt2imgGallery.scrollIntoView();
window.scrollBy(0, -20); // 将滚动位置向上移动 20px
clearInterval(intervalId);
}
}, 50);
原文地址: https://www.cveoy.top/t/topic/fss0 著作权归作者所有。请勿转载和采集!