Created
June 21, 2021 10:42
-
-
Save directionforward/e2e5edaa6b330440a779e24171cb0090 to your computer and use it in GitHub Desktop.
Passive scrollers for jQuery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Passive event listeners | |
jQuery.event.special.touchstart = { | |
setup: function( _, ns, handle ) { | |
this.addEventListener("touchstart", handle, { passive: !ns.includes("noPreventDefault") }); | |
} | |
}; | |
jQuery.event.special.touchmove = { | |
setup: function( _, ns, handle ) { | |
this.addEventListener("touchmove", handle, { passive: !ns.includes("noPreventDefault") }); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment