Keep your hand free from scroll button.
目前為
// ==UserScript==
// @name LazyScroller (beta)
// @version 0.0
// @description Keep your hand free from scroll button.
// @namespace idmresettrial
// @author idmresettrial
// @run-at document-end
// @grant none
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js
// Website list
// @match *://*.vozforums.com/*
// End list
// ==/UserScript==
site = window.location.hostname;
distance = 300;
duration = 200;
pause = 300;
direct = "out";
repeat = "";
lazyScroller = '<div id="lazyScroller"><div class="lazyButton" id="lazyUp">↑</div><div class="lazyButton" id="lazyDown">↓</div></div>';
$("body").append(lazyScroller);
$("#lazyScroller").attr("style","position:fixed; top:100px; left:500px; z-index:999;");
$(".lazyButton").attr("style","margin:10px; width:20px; height:20px; font-size:10px; color:#fff;line-height:20px;text-align:center;background:#7abf16");
$("#lazyScroller .lazyButton").mouseover(function() {
direct = $(this).attr("id");
setTimeout(function() {go();},pause);
});
$("#lazyScroller .lazyButton").mouseout(function() {
direct = "out";
clearTimeout(repeat)
});
function go()
{
if (direct === "lazyUp") {
$("body").animate({scrollTop: ($("body").scrollTop()-distance)}, duration);
repeat = setTimeout(function() {go();},duration+pause);
} else if (direct === "lazyDown") {
$("body").animate({scrollTop: ($("body").scrollTop()+distance)}, duration);
repeat = setTimeout(function() {go();},duration+pause);
} else clearTimeout(repeat);
}