Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

357
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!