mousewheel

< dom‎ | events
Jump to: navigation, search



Overview Table

Synchronous No
Bubbles No
Target dom/Element
Cancelable No
Default action

Examples

View live exampleThe 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.

<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>

Notes

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.

Syntax

Standards information

There are no standards that apply here.

Event handler parameters

pEvtObj [in]
Type: IHTMLEventObj

See also

Related pages (MSDN)

  • 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

This article contains content originally from external sources.

Portions of this content come from the Microsoft Developer Network: [Windows Internet Explorer API reference Article]