-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpage.js
More file actions
42 lines (36 loc) · 984 Bytes
/
Copy pathpage.js
File metadata and controls
42 lines (36 loc) · 984 Bytes
1
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
31
32
33
34
35
36
37
38
39
40
41
42
(function(){
var current = 2;
var page = document.getElementById('page');
var tb = document.getElementById('tb');
var sum = document.getElementsByClassName('flex').length-1;
var main = document.getElementById("main");
var d = 0;
var mousewheelevt=(/Firefox/i.test(navigator.userAgent))? "DOMMouseScroll" : "mousewheel";
main.addEventListener(mousewheelevt, channgepage, false);
setTimeout(function(){
current = 0;
page.style.transform="translate3d(0,-"+current+"00%,0)";
tb.style.opacity = "1";
},1000);
function channgepage(e){
var evt = window.event || e;
// down
d+=evt.wheelDelta;
if(evt.wheelDelta<0 && d<=-240){
if(current<sum ){
d=0;
current++;
tb.style.opacity = "0";
page.style.transform="translate3d(0,-"+current+"00%,0)";
}
}// up
else{
if(current>0 && d>=240){
d=0;
current--;
if(current==0) tb.style.opacity = "1";
page.style.transform="translate3d(0,-"+current+"00%,0)";
}
}
}
})();