Lock the mouse scroll in JavaScript

1

I made a program using polymer and within one of the components in a specific area (the legend area of my graphic) I want the scrolling page not to work, is there any way to do this?

    
asked by anonymous 27.02.2018 / 18:21

1 answer

3

You can hide scroll when the mouse passes in a certain area, in my example I put it to hide overflow by passing <div id="azul"> .

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%;
}
<div id="total">
  <div id="amarela"></div>
  <div id="azul"></div>
</div>

Source: link

    
27.02.2018 / 18:26