-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
33 lines (24 loc) · 820 Bytes
/
script.js
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
//Inject CSS code
var div = document.createElement("div");
div.innerHTML = "<div class='overlay'></div>";
//Hide Facebook bar
$('#pageNav').attr('hidden', 'true');
//Modify mouse scrolling event
document.body.appendChild(div);
if (window.addEventListener) window.addEventListener('DOMMouseScroll', wheel, false);
window.onmousewheel = document.onmousewheel = wheel;
function wheel(event) {
var delta = 0;
if (event.wheelDelta) delta = event.wheelDelta / 120;
else if (event.detail) delta = -event.detail / 3;
handle(delta);
if (event.preventDefault) event.preventDefault();
event.returnValue = false;
}
function handle(delta) {
var time = 1000;
var distance = 50;
$('html, body').stop().animate({
scrollTop: $(window).scrollTop() - (distance * delta)
}, time );
}