[Javascript] sleep trigger code
function sleep(t){ return new Promise(resolve=>setTimeout(resolve,t)); } var doubleClick = 0; async function allImgDownload() { let imgs = document.querySelectorAll(".item-img-pop"); doubleClick = 1; if( doubleClick == 1){ for (let i =0; i < imgs.length; i++) { await sleep(1000); imgs[i].click(); } doubleClick = 0; } else { return false; } }
© 2018 eh2world