Roller event OnMouseWheel

Source: Internet
Author: User

1.Scroll bar event: Document.onscroll = function () {} 2, wheel event: Document.onmousewheel = function () {}(Firefox not supported)(1) Event.wheeldelta > 0: Roller upward (120)
(2) Event.wheeldelta < 0: Roller down (-120)dommousescroll (using AddEventListener event bindings)(Event.detail < 0: Roller up, event.detail > 0: Roller down) "Firefox support method"  Use the call Reference object for Firefox-compatible scroll wheel eventsfunction Scroll (obj, fun) {var down = 0;if (Window.navigator.userAgent.indexof ("Firefox") >-1) {obj.addeventlistent ("Dommousescroll", Fun_nei, false);}else {obj.onmousewheel = Fun_nei;    }function Fun_nei (event, down) {if (event.detail) {Down + = Event.detail;}else{Down + = Event.wheeldetail;        }    }if (window.stoppropagation)    {        Stoppropagation ();}else {window.cancelbubble = true;    }return false;} Elsewhere , scroll () is referenced outside of the function or in another HTML documentScroll (): (1): Scroll ("Document or specific object", function (event, down) {...). Use the down Value ...}); (2): function Hans (event, down) {... Use the Down value ...}            Scroll (document "or specific object", Hans);  

Roller event OnMouseWheel

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.