~scrumplex/website

da46d39e6d469cba19fdba081be6aedd50d216ee — Sefa Eyeoglu 2 months ago 5c91bca
fix: workaround heavy lag caused by tsParticles
1 files changed, 9 insertions(+), 6 deletions(-)

M src/js/particles.js
M src/js/particles.js => src/js/particles.js +9 -6
@@ 4,13 4,16 @@ import ready from "./_utils";

const {matches} = matchMedia("(min-width: 768px)");

function loadParticles() {
    tsParticles.load("particles-js", config).then().catch((e) => {
        console.error("tsparticles failed to load :(");
        console.error(e);
    });
}

if (matches) {
    ready().then(() => {
        tsParticles.load("particles-js", config).then(() => {

        }).catch((e) => {
            console.error("tsparticles failed to load :(");
            console.error(e);
        });
        // tsParticles causes heavy lag while loading, lets delay it, so that all animations are smooth at least
        setTimeout(loadParticles, 500);
    });
}