mirror of
https://github.com/Alvin-Zilverstand/school.git
synced 2026-03-07 13:27:51 +01:00
replace png with webp
This commit is contained in:
@@ -78,9 +78,21 @@
|
||||
}
|
||||
}
|
||||
|
||||
function preloadImages(pokemons) {
|
||||
const head = document.querySelector("head");
|
||||
pokemons.forEach((pokemon) => {
|
||||
const link = document.createElement("link");
|
||||
link.rel = "preload";
|
||||
link.as = "image";
|
||||
link.href = pokemon.image_url;
|
||||
head.appendChild(link);
|
||||
});
|
||||
}
|
||||
|
||||
function displayPokemons(pokemons) {
|
||||
console.log("Displaying Pokémon data:", pokemons);
|
||||
listWrapper.innerHTML = "";
|
||||
preloadImages(pokemons); // Preload images before displaying them
|
||||
|
||||
pokemons.forEach((pokemon) => {
|
||||
const listItem = document.createElement("div");
|
||||
|
||||
Reference in New Issue
Block a user