Hãy cân nhắc việc đánh dấu trình xử lý sự kiện thao tác chạm và bánh xe của bạn là thụ động để cải thiện hiệu suất cuộn trang của bạn.
Solution For JQuery
If you get the error, i.e. Does not user passive listeners to improve scrolling performance, and the resulting file is jquery, then we have a solution for you like below;
To fix this, You need to add the below code just before the </body> tag in your footer as below;
<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>
Click on save and re-run Pagespeed.dev report and you will be fine.
Source: here
