javascript event to scroll over an area or div

1

I have a page where an area or div that does not have the side Scrollbar, simply because it is not necessary. I would like to capture the event when the mouse rotates the roulette over that area because I wanted to use the mouse roulette to Zoom, for example.

    
asked by anonymous 12.02.2016 / 15:04

2 answers

1

Live,

Use ". on" to catch the event. In fact there are two events, to work in different browsers .. "DOMMouseScroll mousewheel"

$('#div').on('DOMMouseScroll mousewheel', function ( event ) {
  if( event.originalEvent.detail > 0 || event.originalEvent.wheelDelta < 0 ) {
    console.log('Para baixo');
  } else {
    console.log('Para cima');
  }
  return false;
});
    
12.02.2016 / 15:31
1

Friend. You have a command to only mouse to zoom in on the image. Like you did not put code.

Follows:

<script language="javascript">
 <!--
  function aumenta(obj){
obj.height=obj.height*2;
obj.width=obj.width*2;
   }

  function diminui(obj){
obj.height=obj.height/2;
obj.width=obj.width/2;
  }
    </script>

Html:

    <p><img src="IMAGEM" width='258' height='45' alt="img" onMouseOver="aumenta(this)" onMouseOut="diminui(this)">
    
12.02.2016 / 15:42