Disabling mouse scrolling

后端 未结 4 1192
后悔当初
后悔当初 2020-12-10 18:11

I have a page with a textbox in it. When I scroll the textbox to the bottom, the document will scroll after it. How to disable mouse scrolling for the document but enable sc

4条回答
  •  执念已碎
    2020-12-10 18:18

    This solution is same of Sameera but without Jquery:

    var azul = document.getElementById("azul");
    
    azul.onmouseover = function(){
       document.body.style.overflowY = "hidden";
    };
    
    azul.onmouseout = function(){
       document.body.style.overflowY = "auto";
    };
    #total{
      height: 900px;
    }
    
    #amarela{
      background-color: yellow;
      height:50%;
    }
    
    #azul{
      background-color: blue;
      height:50%;
    }

提交回复
热议问题