Search the Community
Showing results for tags 'onmousewheel'.
-
Hi, I have this code to evaluate onmousewheel in the screen! How can i use it in Babylon? In fact I want to use the "rolled" var value in a babylon script! <head> <script type="text/javascript"> function MouseScroll (event) { var rolled = 0; if ('wheelDelta' in event) { rolled = event.wheelDelta; } else { // Firefox // The measurement units of the detail and wheelDelta properties are different. rolled = -40 * event.detail; } var info = document.getElementById ("info"); info.innerHTML = rolled; } function Init () { // for mouse scrolling in Firefox var elem = document.getElementById ("myDiv"); if (elem.addEventListener) { // all browsers except IE before version 9 // Internet Explorer, Opera, Google Chrome and Safari elem.addEventListener ("mousewheel", MouseScroll, false); // Firefox elem.addEventListener ("DOMMouseScroll", MouseScroll, false); } else { if (elem.attachEvent) { // IE before version 9 elem.attachEvent ("onmousewheel", MouseScroll); } } } </script> </head> <body onload="Init ();"> Use the mouse wheel on the field below. <div id="myDiv" style="width:200px; height:200px; overflow:auto;"> <div style="height:2000px; background-color:#a08080;"></div> </div> <br /> The last roll amount: <span id="info" style="background-color:#e0e0d0;"></span> </body>