Greasy Fork is available in English.
AutoScroll - 双击切换自动滚屏
< Feedback on AutoScroll
Thanks for the headstartI can see where you were going with this but it didn't quite work right, for me. With a little tweak, it did. I added a speed value to the variable definitions, a Y position value, and the ability to stop, scroll, and restart where you are.(function(document) { var enable = false, handler = 0, sSpeed = 1000, sTop, dbclick = function() { enable = !enable; clearTimeout(handler); if (enable) { aScroll(); } else { sTop = undefined; } }; document.body.removeEventListener('dblclick', dbclick); document.body.addEventListener('dblclick', dbclick); var aScroll = function() { if (enable) { if (sTop === undefined) sTop = window.scrollY; sTop += 3; window.scrollTo(0, sTop); } handler = setTimeout(aScroll, sSpeed); };})(document);
Yanıt göndermek için oturum açın.
Thanks for the headstart
I can see where you were going with this but it didn't quite work right, for me. With a little tweak, it did. I added a speed value to the variable definitions, a Y position value, and the ability to stop, scroll, and restart where you are.
(function(document) {
var enable = false,
handler = 0,
sSpeed = 1000,
sTop,
dbclick = function() {
enable = !enable;
clearTimeout(handler);
if (enable) {
aScroll();
}
else {
sTop = undefined;
}
};
document.body.removeEventListener('dblclick', dbclick);
document.body.addEventListener('dblclick', dbclick);
var aScroll = function() {
if (enable) {
if (sTop === undefined) sTop = window.scrollY;
sTop += 3;
window.scrollTo(0, sTop);
}
handler = setTimeout(aScroll, sSpeed);
};
})(document);