Created
March 1, 2023 22:32
-
-
Save brianleejackson/c199f4e7b3882b3c79434f6c918e086e to your computer and use it in GitHub Desktop.
Only load FastClick on mobile devices (no tablets or desktop)
This file contains hidden or 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
<script> | |
if (window.innerwidth < 900) { | |
document.write('<script type="text/javascript" src="https://domain.com/wp-content/plugins/perfmatters/vendor/fastclick/fastclick.min.js"><\/script>'); | |
} | |
</script> | |
<script> | |
if(window.innerWidth < 900) { | |
if('addEventListener' in document) { | |
document.addEventListener('DOMContentLoaded', function() { | |
FastClick.attach(document.body); | |
}, false); | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment