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
}
);

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

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