JavaScript Reference/Event Handlers Reference/onMouseWheel

Материал из Web эксперт
Перейти к: навигация, поиск

"onMouseWheel" Example

    
<html>
<body>
    <p>Move the pointer on top of the image and then move the mouse wheel up or down.</p>
    <img id="yourimage" 
         src="http://www.wbex.ru/style/logo.png" 
         onmousewheel="alert("Wheel Delta: " + event.wheelDelta);">
</body>
</html>



"onMouseWheel" is applied to

+----------------+--------------------------------------------------------------+
| Applied_To     |<a>                             <address>                     |
|                |<applet>                        <area>                        |
|                |<b>                             <bdo>                         |
|                |<big>                           <blockquote>                  |
|                |<body>                          <button>                      |
|                |<caption>                       <center>                      |
|                |<cite>                          <code>                        |
|                |<custom>                        <dd>                          |
|                |<dfn>                           <dir>                         |
|                |<div>                           <dl>                          |
|                |document                        <dt>                          |
|                |<em>                            <embed>                       |
|                |<fieldset>                      <font>                        |
|                |<form>                          <hn>                          |
|                |<hr>                            <i>                           |
|                |<img>                           <input type="button">         |
|                |<input type="checkbox">         <input type="file">           |
|                |<inputtype="image">             <input type="password">       |
|                |<input type="radio">            <input type="reset">          |
|                |<input type="submit">           <input type="text">           |
|                |<kbd>                           <label>                       |
|                |<legend>                        <li>                          |
|                |<listing>                       <map>                         |
|                |<marquee>                       <menu>                        |
|                |<nobr>                          <ol>                          |
|                |<p>                             <pre>                         |
|                |<rt>                            <ruby>                        |
|                |<s>                             <samp>                        |
|                |<select>                        <small>                       |
|                |<span>                          <strike>                      |
|                |<strong>                        <sub>                         |
|                |<sup>                           <table>                       |
|                |<tbody>                         <td>                          |
|                |<textarea>                      <tfoot>                       |
|                |<th>                            <thead>                       |
|                |<tr>                            <tt>                          |
|                |<u>                             <ul>                          |
|                |<var>                           <xmp>                         |
+----------------+--------------------------------------------------------------+



"onMouseWheel" Properties

+----------------+--------------------------------------------------------------+
| Properties     |altKey                          altLeft                       |
|                |cancelBubble                    clientX                       |
|                |clientY                         ctrlKey                       |
|                |ctrlLeft                        offsetX                       |
|                |offsetY                         screenX                       |
|                |screenY                         shiftKey                      |
|                |shiftLeft                       srcElement                    |
|                |type                            wheelDelta                    |
|                |x                               y                             |
+----------------+--------------------------------------------------------------+



"onMouseWheel" Syntax and Note

Note:
    
This event fires when the mouse wheel button rotates. 
This event is the only one that exposes the wheelDelta object property. 
wheelDelta returns a positive value when the wheel button has rotated away from the user, 
and a negative value when the wheel button has rotated toward the user.