Js scroll wheel for screen cutting
Because the entire project is not self-written, it just helps others write js scroll code, and other projects are not yet online, so only part of the code that I wrote is posted,
Effect: When the scroll wheel is clicked, the screen on the Web tracking page is switched up and down.
(The following code has been successfully tested on IE, chrome, and FireFox browsers on the local computer)
Var sum = 0; var oTxt = document. getElementById ("txt"); var scrollFunc = function (e) {var direct = 0; var men = $ (". menu_m "). find (". menu "). find ("li"); men. each (function (j) {if ($ (this ). attr ("class") = "m_selected") {sum = j ;}}); e = e | window. event; if (e. wheelDelta) {// IE/Opera/Chrome if (navigator. appName = 'netscape ') {// Chorme rolls twice, so 0.5 if (e. wheelDelta> 0) {sum = parseFloat (sum-0.5);} else {sum = parseFloat (sum) + 0.5 ;}} else {if (e. wheelDelta> 0) sum = parseFloat (sum-1); else sum = parseFloat (sum + 1) ;}} else if (e. detail) {// Firefox // The upward and downward values of firefox are not the same as those above. You can print out if (e. detail> 0) sum = parseFloat (sum + 1); else sum = parseFloat (sum-1) ;}// sum, the following is what you want to do, here, I want to write a screen jump that is associated with the current project, but add return false. Otherwise, it will appear in google and ie, var sizes =$ (". menu_m "). find (". menu "). find ("li "). size (); if (sum> = 0 & parseFloat (sum) <= parseFloat (sizes)-1) {men. each (function (j) {$ (this ). removeClass ("m_selected")}); $ (". menu_m "). find (". menu li: eq ("+ sum + ")"). find ("span "). click (); return false ;}}/* Register event */if (document. addEventListener) {document. addEventListener ('domainscroll', scrollFunc, false);} // W3Cwindow. onmousewheel = document. onmousewheel = scrollFunc; // IE/Opera/Chrome/Safari