出于某种原因,我在尝试识别 Firefox 中的鼠标滚轮事件时遇到了麻烦。这适用于 IE、Chrome、Safari、Opera,但不适用于 FF。我在 DOMMouseScroll 上附加了一个事件侦听器,它应该在 FF 中被识别。
$(document).unbind('mousewheel DOMMouseScroll').on('mousewheel DOMMouseScroll', function(e) {
var evt = event || e || window.event;
var delta = evt.detail < 0 || evt.wheelDelta > 0 ? 1 : -1;
if (delta < 0) {
// scroll down
} else {
// scroll up
}
});