Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

364
Visualizações
Transition between images on an image slideshow instead of "white" flash on the page

I have a slideshow of images (that changed when I click on different options. So the images don't change automatically) and even tho I first preload all of the images when the application is loaded ( I have all of this in react ) it still "flashes white" between them. The preload code:

    useEffect(() => {
        setPreloaded(false)
        const preLoadImages = function preLoadImages(imageUrl, numberOfImagesPerColumn) {
            const promises = [];
            for (let index = 0; index < numberOfImagesPerColumn; index++) {
                const fImgUrl = `${imageUrl}${index + 1}.${t}`;
                promises.push(loadImage(fImgUrl).catch((err) => {
                    //  TODO: Handle 404 Error
                }));
            }
            return Promise.all(promises);
        };

        function loadImage(src) {
            return new Promise(((resolve, reject) => {
                const img = new Image();
                img.onload = function () {
                    resolve(img);
                };
                img.onerror = function () {
                    reject(src);
                };
                img.src = src;
            }));
        }

        preLoadImages(p, n).then(() => {
            setPreloaded(true);
        });
    }, [p]);

How can I make a smooth transition between them or like the old image will still stay until the new one is loaded completely and will transition without a "white flash" between them ?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda