0
我一直在試圖弄清爲什麼我的smoothscroll功能在Firefox中不起作用?它在Chrome,Microsoft Edge等其他瀏覽器中運行良好。請有人幫助我。請檢查此筆:https://codepen.io/anon/pen/oWPaNx鼠標滾輪不能在Firefox中工作
function smoothScroll(time, distance) {
var $window = $(window);
var scrollTime = time;
var scrollDistance = distance;
$window.on("wheel mousewheel DOMMouseScroll", function (event) {
event.preventDefault();
var delta = event.originalEvent.wheelDelta/80 || -event.originalEvent.detail/3;
var scrollTop = $window.scrollTop();
var finalScroll = scrollTop - parseInt(delta * scrollDistance);
TweenMax.to($window, scrollTime, {
scrollTo: {
y: finalScroll,
autoKill: true
},
ease: Power4.easeOut,
overwrite: 5
});
});
}
你的代碼工作。你忘了添加這個插件:https://cdnjs.cloudflare.com/ajax/libs/gsap/1.19.1/plugins/ScrollToPlugin.min.js – Phil
@Phil謝謝你,但它仍然不能在Firefox中工作。檢查更新的筆請https://codepen.io/anon/pen/oWPaNx – Enthusiast