const list = [
"./img.png",//
"//be-fe.github.io/static/images/iSlider-card/10.jpg",//
"./load.gif",//
"//be-fe.github.io/static/images/iSlider-card/12.jpg",//
null,//
"//be-fe.github.io/static/images/iSlider-card/17.jpg",//
];
const placeholder = "";
const loadError = "";
const gen = () => {
let endSrc = placeholder;
let html = "";
list.forEach((ele) => {
if(ele){
const image = new Image();
image.src = ele;
image.onload = () => {
endSrc = ele;
};
image.onerror = () => {
endSrc = loadError;
};
}
html += `${endSrc}
`;
});
// html onload onerror[loaderror ]
return html;
}
$("body").append(gen())