onmousewheel event (Internet Explorer)

Switch View :
ScriptFree
onmousewheel event

[This documentation is preliminary and is subject to change.]

Fires when the wheel button is rotated.

Syntax

HTML Attribute <element onmousewheel = "handler(event)">
Event Property object.onmousewheel = handler;
attachEvent Method object.attachEvent("onmousewheel", handler)
addEventListener Method object.addEventListener("mousewheel", handler, useCapture)

Standards information

There are no standards that apply here.

Event information

SynchronousNo
BubblesNo
CancelableNo

Event handler parameters

pEvtObj [in]

Type: IHTMLEventObj

Remarks

The onmousewheel event is the only event that exposes the wheelDelta property. This property indicates the distance that the wheel button has rotated, expressed in multiples of 120. A positive value indicates that the wheel button has rotated away from the user. A negative value indicates that the wheel button has rotated toward the user. See the example below.

onmousewheel was introduced in Microsoft Internet Explorer 6

Scrolls the page up or down.

To invoke this event, do one of the following:

  • Rotate the wheel button.

Examples

The following example shows how to use the onmousewheel event and the wheelDelta parameter to expand and contract a picture in response to the wheel button being moved.

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/onmousewheelEX.htm


<html>
<head>
<script type="text/javascript">
var count = 10;
function Picture()
{
    if (event.wheelDelta >= 120)
        Resize(++count);
    else if (event.wheelDelta <= -120)
        Resize(--count);   
    return false;
}
function Resize(c){    
    oImage.style.zoom = c + '0%';
}
</script>
</head>
<body>
<img id="oImage" src="Sample.png" alt="sample "onmousewheel="Picture()">
</body>
</html>

See also

a
abbr
acronym
address
applet
area
audio
b
bdo
big
blockQuote
body
button
canvas
caption
center
cite
code
custom
dd
del
dfn
dir
div
dl
document
dt
em
embed
fieldSet
font
form
hn
hr
i
img
input type=button
input type=checkbox
input type=file
input type=image
input type=password
input type=radio
input type=reset
input type=submit
input type=text
ins
kbd
label
legend
li
listing
map
marquee
menu
noBR
object
ol
p
plainText
pre
q
rt
ruby
s
samp
select
small
source
span
strike
strong
sub
sup
table
tBody
td
textArea
tFoot
th
tHead
tr
tt
u
ul
var
video
window
xmp
Reference
onscroll
onmousemove
onmousedown
onmouseout
onmouseover
onmouseup

 

 

Build date: 3/14/2012