js响应鼠标滚轮事件

1
var up = $('up'), down = $('down'), log;
2
3
[up, down].each(function(arrow) {
4
arrow.setstyle('opacity', .1);
5
});
6
7
document.addevent('mousewheel', function(event) {
8
event = new event(event);
9
10
/* mousewheel up */
11
if (event.wheel > 0) {
12
up.setstyle('opacity', 1);
13
down.setstyle('opacity', .1);
14
log = 'up';
15
}
16
/* mousewheel down*/
17
else if (event.wheel < 0) {
18
up.setstyle('opacity', .1);
19
down.setstyle('opacity', 1);
20
log = 'down';
21
}
22
23
$('log').sethtml(log);
24
25
var cls = function() {
26
[up, down].each(function(arrow) {
27
arrow.setstyle('opacity', .1);
28
});
29
}.delay(100);
30

欢迎加群互相学习,共同进步。qq群:ios: 58099570 | android: 330987132 | go:217696290 | python:336880185 | 做人要厚道,转载请注明出处!http://www.cnblogs.com/sunshine-anycall/archive/2009/02/25/1397887.html