Slow scroll speed down

后端 未结 4 1022
别跟我提以往
别跟我提以往 2020-12-06 05:58

Ok, so I can\'t find anything about this.

I know it is horrible to change the scroll speed of a site, but I need to do this for a site which is more a game than a s

相关标签:
4条回答
  • 2020-12-06 06:14

    Just go to the windows mouse properties in control panel there you can set the amount of pages to slide through with one scroll.

    0 讨论(0)
  • 2020-12-06 06:17

    https://github.com/nathco/jQuery.scrollSpeed

    Demo

    You can add the value speed in this code

    0 讨论(0)
  • 2020-12-06 06:24

    NiceScroll Plugin

    jQuery

    $(document).ready(function() { 
    
        $("html").niceScroll();
    
      }
    
    );
    
    0 讨论(0)
  • 2020-12-06 06:25

    Look this fiddle: http://jsfiddle.net/promatik/NFk2L/ , you can set time and distance!

    JS code

    if (window.addEventListener) window.addEventListener('DOMMouseScroll', wheel, false);
    window.onmousewheel = document.onmousewheel = wheel;
    
    function wheel(event) {
        var delta = 0;
        if (event.wheelDelta) delta = event.wheelDelta / 120;
        else if (event.detail) delta = -event.detail / 3;
    
        handle(delta);
        if (event.preventDefault) event.preventDefault();
        event.returnValue = false;
    }
    
    function handle(delta) {
        var time = 1000;
        var distance = 300;
    
        $('html, body').stop().animate({
            scrollTop: $(window).scrollTop() - (distance * delta)
        }, time );
    }
    

    if (window.addEventListener) window.addEventListener('DOMMouseScroll', wheel, false);
    window.onmousewheel = document.onmousewheel = wheel;
    
    function wheel(event) {
      var delta = 0;
      if (event.wheelDelta) delta = event.wheelDelta / 120;
      else if (event.detail) delta = -event.detail / 3;
    
      handle(delta);
      if (event.preventDefault) event.preventDefault();
      event.returnValue = false;
    }
    
    function handle(delta) {
      var time = 1000;
      var distance = 300;
    
      $('html, body').stop().animate({
        scrollTop: $(window).scrollTop() - (distance * delta)
      }, time);
    }
    #myDiv {
      height: 800px;
      width: 100px;
      background-color: #CCF;
      font-family: 'Trebuchet MS';
      font-size: 12px;
      line-height: 24px;
      padding: 5px;
      margin: 5px;
    }
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
    <div id="myDiv">
      Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
      in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
    </div>

    0 讨论(0)
提交回复
热议问题