Last active
October 5, 2021 09:41
-
-
Save mitchellkrogza/4298c0c6bdfe31a3ea639d5e30e188b2 to your computer and use it in GitHub Desktop.
Google Pagespeed FIX does not use passive event listeners warning
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 | |
// Add this to your own custom.js file < YOU NEED TO CREATE THIS FILE YOURSELF | |
// Call the file in your body using | |
// <script src="https://mydomain.com/wp-content/themes/my-child-theme/inc/js/custom.js" ></script> | |
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