Skip to content

Latest commit

 

History

History
27 lines (24 loc) · 856 Bytes

jquery.md

File metadata and controls

27 lines (24 loc) · 856 Bytes

Does not use passive listeners to improve scrolling performance (Lighthouse Report)

: Add the following code after jquery. This will fix it and removes the Pagespeed warning

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 });
    }
};