我正在寻找一个香草javascript解决方案(或香草库)来实现平滑鼠标滚轮
Something like this jsfiddle 但是有了香草JS
我不想轻松点击#someLink。
使用鼠标滚轮专注于滚动以模拟触控板效果
这是使用TweenMax和ScrollToPlugin的code,但仍尝试传递给vanilla:S
var $window = $(window);
var scrollTime = 1.2;
var scrollDistance = 170;
window.addEventListener("mousewheel DOMMouseScroll", function(event){
event.preventDefault();
var delta = event.originalEvent.wheelDelta/120 || -event.originalEvent.detail/3;
var scrollTop = $window.scrollTop();
var finalScroll = scrollTop - parseInt(delta*scrollDistance);
TweenMax.to($window, scrollTime, {
scrollTo : { y: finalScroll, autoKill:true },
ease: Power1.easeOut,
overwrite: 5
});
});