Mouse wheel event MouseWheel

Source: Internet
Author: User

This event is different from IE under the standard.

Firefox is implemented according to the standard. The event name is "DOMMouseScroll", and that of IE is "mousewheel ".

Of course, one line of code solves the compatibility problem.
VarMousewheel = Document. All? "Mousewheel": "dommousescroll ";
For the event attribute, ie is event. wheeldelta, Firefox is the event. Detail attribute with different direction values. IE is rolled up> 0, and Firefox is rolled down> 0. Use the plug-in mouse wheel extension 3.0.2

 

Http://plugins.jquery.com/files/jquery.mousewheel.3.0.2.zip address http://brandonaaron.net/code/mousewheel/demos

 

 

Jquery (function ($ ){
$ ('Div. mousewheel_example ')
. BIND ('mousewheel ', function (event, Delta ){
VaR dir = delta> 0? 'Up': 'low ',
Vel = math. Abs (DELTA );
$ (This). text (dir + 'at a velocity of '+ vel );
Return false;
});
});

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.