LazyScroller (beta)

Keep your hand free from scroll button.

当前为 2015-01-05 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name LazyScroller (beta)
  3. // @version 0.0
  4. // @description Keep your hand free from scroll button.
  5. // @namespace idmresettrial
  6. // @author idmresettrial
  7. // @run-at document-end
  8. // @grant none
  9.  
  10. // @require http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js
  11.  
  12. // Website list
  13.  
  14. // @match *://*.vozforums.com/*
  15.  
  16.  
  17. // End list
  18.  
  19.  
  20. // ==/UserScript==
  21.  
  22. site = window.location.hostname;
  23.  
  24. distance = 300;
  25. duration = 200;
  26. pause = 300;
  27. direct = "out";
  28.  
  29. repeat = "";
  30. lazyScroller = '<div id="lazyScroller"><div class="lazyButton" id="lazyUp">↑</div><div class="lazyButton" id="lazyDown">↓</div></div>';
  31.  
  32. $("body").append(lazyScroller);
  33. $("#lazyScroller").attr("style","position:fixed; top:100px; left:500px; z-index:999;");
  34. $(".lazyButton").attr("style","margin:10px; width:20px; height:20px; font-size:10px; color:#fff;line-height:20px;text-align:center;background:#7abf16");
  35.  
  36. $("#lazyScroller .lazyButton").mouseover(function() {
  37. direct = $(this).attr("id");
  38. setTimeout(function() {go();},pause);
  39. });
  40.  
  41. $("#lazyScroller .lazyButton").mouseout(function() {
  42. direct = "out";
  43. clearTimeout(repeat)
  44. });
  45.  
  46.  
  47. function go()
  48. {
  49. if (direct === "lazyUp") {
  50. $("body").animate({scrollTop: ($("body").scrollTop()-distance)}, duration);
  51. repeat = setTimeout(function() {go();},duration+pause);
  52. } else if (direct === "lazyDown") {
  53. $("body").animate({scrollTop: ($("body").scrollTop()+distance)}, duration);
  54. repeat = setTimeout(function() {go();},duration+pause);
  55. } else clearTimeout(repeat);
  56. }

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址