Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Hi you can do that by adding a event listener. I have searched for the same and got the below code snippet and it is working. check you have the same requirement</p> <hr> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;Mouse Scroll Wheel example in JavaScript&lt;/title&gt; &lt;style&gt; #scroll { width: 250px; height: 50px; border: 2px solid black; background-color: lightyellow; top: 100px; left: 50px;`enter code here` position:absolute; } &lt;/style&gt; &lt;script language="javascript"&gt; window.onload = function() { //adding the event listerner for Mozilla if(window.addEventListener) document.addEventListener('DOMMouseScroll', moveObject, false); //for IE/OPERA etc document.onmousewheel = moveObject; } function moveObject(event) { var delta = 0; if (!event) event = window.event; // normalize the delta if (event.wheelDelta) { // IE and Opera delta = event.wheelDelta / 60; } else if (event.detail) { // W3C delta = -event.detail / 2; } var currPos=document.getElementById('scroll').offsetTop; //calculating the next position of the object currPos=parseInt(currPos)-(delta*10); //moving the position of the object document.getElementById('scroll').style.top = currPos+"px"; document.getElementById('scroll').innerHTML = event.wheelDelta + ":" + event.detail; } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; Scroll mouse wheel to move this DIV up and down. &lt;div id="scroll"&gt;Event Affect&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; ------------------------------------------------------------ </code></pre> <p>based on the delta variable you can write your own custom functionality.</p> <p>In html 5 mouse scroll event is being handled you can try in that way also</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload