I wanted to use the wheel mouse button to slide the slider up or down to use it in a Mapping application for Zoom In/Out, I used a java script function to detect the wheel mouse on the Map, I wanted the Zoom function to start when the user release the wheel mouse so I added a timer to detect that the user stopped using the wheel button
var hTimer = null;
function wheelZoom(e)
{
try
{
e = e ? e : window.event;
var raw = e.detail ? e.detail : e.wheelDelta;
var normal = e.detail ? e.detail * -1 : e.wheelDelta / 40;
if (normal > 0)
{
var slider = $find(“Slider2″);
if (slider != null)
{
slider.set_Value(slider.get_Value()-1);
}
else
{
}
}
else if(normal < 0)
{
var slider = $find(“Slider2″);
if (slider != null)
{
slider.set_Value(slider.get_Value()+1);
}
else
{
}
}
if (hTimer != null)
{
window.clearTimeout(hTimer)
}
else
{
}
hTimer = window.setTimeout(doZoomWheel, 500)
cancelEvent(e);
}
catch(err)
{
alert(err.message)
}
finally
{
}
}
In the above code the slider will response to the wheel mouse but the Zoom function will be called only when the user stop using the wheel button
function doZoomWheel()
{
if (hTimer)
{
hTimer = null;
Zoom();
}
}






