I always wanted to do this. The principle is to listen to the mouse scroll wheel event. I can continue to scatter this effect to other applications, such as slice scaling and page scaling.
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <ptml xmlns = "http://www.w3.org/1999/xhtml"> <pead> <meta http-equiv =" content-Type "content =" text/html; charset = gb2312 "/> <title> scroll wheel effect-http://www.51obj.cn/</title> </pead> <body> <input type =" text "id =" txt "value =" 0 "/> </body> </ptml>
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]
It has been tested by ff, ie, opera, and chrome. 45 ~ If you use
Copy codeThe Code is as follows:
/* Register an event */
If (document. attachEvent ){
Document. attachEvent ('onmousewheel ', scrollFunc );
} Else if (document. addEventListener ){
Document. addEventListener ('dommousescroll', scrollFunc, false );
}
Chrome does not work, change it
Copy codeThe Code is as follows:
/* Register an event */
If (document. addEventListener ){
Document. addEventListener ('dommousescroll', scrollFunc, false );
} // W3C
Window. onmousewheel = document. onmousewheel = scrollFunc; // IE/Opera/Chrome
You can.
Author: Wang Hongjian (51obj)