function mouseHandlers(event) {
var fireEvent;
var newDelta = event.deltaY;
if(this.oldDelta !== null) {
if(this.oldDelta < 0 && newDelta > 0) {
fireEvent = true;
}
if(this.oldDelta > 0 && newDelta < 0) {
fireEvent = true;
}
if(this.oldDelta > 0 && newDelta > 0) {
if(this.oldDelta < newDelta) {
fireEvent = true;
} else {
fireEvent = false;
}
}
if(this.oldDelta < 0 && newDelta < 0) {
if(this.oldDelta > newDelta) {
fireEvent = true;
} else {
fireEvent = false;
}
}
} else {
fireEvent = true;
}
this.oldDelta = newDelta;
if(fireEvent === true) {
//CALL FUNCTION ONCE
}
}
1 Response
Write a comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.