原生js鼠标滑动滚轮事件
var agent = navigator.userAgent;
if(/.*Firefox.*/.test(agent)) {
document.addEventListener("DOMMouseScroll", function(e) {
e = e || window.event;
var detail = e.detail;
if(detail > 0) {
var input = document.getElementById("input");
input.blur();
} else {
console.warn("鼠标向上滚动");
}
});
} else {
document.onmousewheel = function(e) {
e = e || window.event;
var wheelDelta = e.wheelDelta;
if(wheelDelta > 0) {
var input = document.getElementById("input");
input.blur();
} else {
var input = document.getElementById("input");
input.blur();
}
}
}