Answers for "preload images"

1

preload images

<link rel="preload" as="image" href="wolf.jpg" imagesrcset="wolf_400px.jpg 400w, wolf_800px.jpg 800w, wolf_1600px.jpg 1600w" imagesizes="50vw">
Posted by: Guest on June-30-2021
0

preload images javascript

let preloadedMaps = [];
    let preloadedWorkRoutes = [];
    console.log('asdasdasdas')
    function preloadImages(preloadedMaps, preloadedWorkRoutes){
      var maps = [`${workMapDesktop}`, `${workMapMobile}`, `${playMapDesktop}`, `${playMapMobile}`];
      var workRoutes = workRoutesDesktop.concat(workRoutesMobile);
      for(let i = 0; i < workRoutes.length; i++) {
        preloadedWorkRoutes[i] = new Image();
        preloadedWorkRoutes[i].src = workRoutes[i]
      }
      for(let i = 0; i < maps.length; i++) {
        preloadedMaps[i] = new Image();
        preloadedMaps[i].src = maps[i]
      }
    }        
    preloadImages(preloadedMaps, preloadedWorkRoutes);
Posted by: Guest on April-14-2020

Browse Popular Code Answers by Language