@zhuxiaozy/clipimg
Version:
33 lines • 896 B
JavaScript
export default class Mouse {
constructor() {
this.init();
}
scrollUp() { }
scrollDown() { }
init() {
if (window.document.addEventListener) {
window.document.addEventListener("DOMMouseScroll", this.scrollFunc.bind(this), false);
}
window.addEventListener("mousewheel", this.scrollFunc.bind(this));
}
scrollFunc(e) {
e = e || window.event;
if (e.wheelDelta) {
if (e.wheelDelta > 0) {
this.scrollUp();
}
if (e.wheelDelta < 0) {
this.scrollDown();
}
}
else if (e.detail) {
if (e.detail > 0) {
this.scrollDown();
}
if (e.detail < 0) {
this.scrollUp();
}
}
}
}
//# sourceMappingURL=mouse.js.map