Created
December 20, 2018 22:01
-
-
Save danfoust/ced2e6495165be6b64d165ad3753f087 to your computer and use it in GitHub Desktop.
Improves scroll performance by making jQuery events passive. Run directly after jQuery script is loaded. Read more: https://stackoverflow.com/questions/46094912/added-non-passive-event-listener-to-a-scroll-blocking-touchstart-event
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
jQuery.event.special.touchstart = { | |
setup: function( _, ns, handle ){ | |
if ( ns.includes("noPreventDefault") ) { | |
this.addEventListener("touchstart", handle, { passive: false }); | |
} else { | |
this.addEventListener("touchstart", handle, { passive: true }); | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment