jquery use passive listener
All checks were successful
website-main / prod-build (push) Successful in 9s
website-main / test-build (push) Successful in 6s

This commit is contained in:
Denys Konovalov 2024-01-20 20:28:20 +01:00
parent 57a8b255a6
commit 2b5ac1e3bf
Signed by: Denys Konovalov
GPG Key ID: 0037E1B0E33BD2C9

@ -20,6 +20,29 @@
{{ range .Site.Params.plugins.head_js }} {{ range .Site.Params.plugins.head_js }}
<script src="{{ . | absURL }}" type="text/javascript"></script> <script src="{{ . | absURL }}" type="text/javascript"></script>
{{ end }} {{ end }}
<!-- jquery passive listener fixes -->
<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") });
}
};
jQuery.event.special.wheel = {
setup: function( _, ns, handle ){
this.addEventListener("wheel", handle, { passive: true });
}
};
jQuery.event.special.mousewheel = {
setup: function( _, ns, handle ){
this.addEventListener("mousewheel", handle, { passive: true });
}
};
</script>
<link href="/pagefind/pagefind-ui.css" rel="stylesheet"> <link href="/pagefind/pagefind-ui.css" rel="stylesheet">