Closed koraysels closed 8 years ago
document.onmousewheel = function () {
customScroll();
};
//Smoothscrolling for the masses!
$(function () {
var $window = $(window);
document.onmousewheel = function () {
customScroll();
};
if (document.addEventListener) {
document.addEventListener('DOMMouseScroll', customScroll, false);
}
function customScroll(event) {
var delta = 0;
if (!event) {
event = window.event;
}
if (event.wheelDelta) {
delta = event.wheelDelta / 120;
} else if (event.detail) {
delta = -event.detail / 3;
}
if (delta) {
var scrollTop = $window.scrollTop();
var finScroll = scrollTop - parseInt(delta * 70);
TweenMax.to($window, 0.3, {
scrollTo: {y: finScroll, autoKill: true},
ease: Power4.easeOut,
autoKill: true,
overwrite: 5,
});
}
if (event.preventDefault) {
event.preventDefault();
}
event.returnValue = false;
}
});
eeuw