M
M
Mikhail Rerberg2018-08-29 11:44:57
Client side optimization
Mikhail Rerberg, 2018-08-29 11:44:57

How to improve scroll performance to pass Google audit?

Hello!
5b865caaac217851106324.png
I came across this presentation from Google, began to read and look for a solution to the problem. There is not much information, often they write that this code helps:

document.addEventListener('mousewheel', event => {

}, { passive: true });

document.addEventListener('wheel', event => {

}, { passive: true });

document.addEventListener('scroll', event => {

}, { passive: true });


document.addEventListener('touchstart', event => {

}, { passive: true });

document.addEventListener('touchend', event => {

}, { passive: true });

document.addEventListener('touchmove', event => {

}, { passive: true });

But when I run the audit again, the recommendation remains. How to fix it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mirzhalol Mirkhomitov, 2021-05-06
@Mirami97

jQuery.event.special.touchstart = {
    setup: function( _, ns, handle ) {
        this.addEventListener("touchstart", handle, { passive: !ns.includes("noPreventDefault") });
    }
};

Added this code. PageSpeed ​​stopped swearing

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question