Share a JS implementation to determine the mouse wheel scroll up and down:
1 <Scripttype= "Text/javascript"> 2 varScrollfunc= function(e) {3 e=e||window.event; 4 if(E.wheeldelta) {//Judging browser ie, Google pulley events5 if(E.wheeldelta> 0) { //When the pulley is rolling up6 Alert ("Pulley Roll Up"); 7 } 8 if(E.wheeldelta< 0) { //When the pulley is rolling down9 Alert ("Pulley Scroll down"); Ten } One } Else if(e.detail) {//Firefox pulley events A if(E.detail> 0) { //When the pulley is rolling up - Alert ("Pulley Roll Up"); - } the if(E.detail< 0) { //When the pulley is rolling down - Alert ("Pulley Scroll down"); - } - } + } - //to bind a page to a pulley scroll event + if(document.addeventlistener) {//Firefox A Document.addeventlistener ('Dommousescroll', Scrollfunc,false); at } - //rolling pulley triggering Scrollfunc method//ie Google - Window.onmousewheel=Document.onmousewheel=Scrollfunc; - </Script>
JavaScript determines the scroll of the mouse wheel up and down