text stringlengths 0 106k |
|---|
imageContainer.style.justifyContent = 'space-around'; |
imageContainer.style.marginTop = '20px'; |
urls.forEach((url, index) => { |
let link = document.createElement('a'); |
link.href = url; |
link.setAttribute('data-fancybox','gallery'); |
link.style.width = isMobile() ? 'calc(100% - 20px)' : 'calc(50% - 20px)'; |
link.style.display = 'flex'; |
link.style.justifyContent = 'center'; |
let spinner = document.createElement('div'); |
spinner.className = 'spinner'; |
for(let i = 1; i <= 5; i++) { |
let div = document.createElement('div'); |
div.className = 'rect' + i; |
spinner.appendChild(div); |
} |
link.appendChild(spinner); |
imageContainer.appendChild(link); |
// Replace the placeholder with the image when it has loaded |
let img = new Image(); |
img.onload = function() { |
setTimeout(() => { |
spinner.style.display = 'none'; |
link.appendChild(img); |
}, 5000); // Add 5 seconds delay here |
}; |
img.src = url; |
img.style.width = '100%'; |
img.style.height = 'auto'; |
img.style.margin = '10px'; |
img.style.borderRadius = '10px'; |
}); |
// Add the image container to the DOM, right after the Generate button |
document.querySelector('.btn').after(imageContainer); |
$('[data-fancybox="gallery"]').fancybox({ |
buttons: [ |
'zoom', |
'fullScreen', |
'download', |
'close' |
], |
thumbs: { |
autoStart: false, |
hideOnClose: true |
} |
}); |
} |
``` |
Now, there will be a delay of 5 seconds before each image replaces its respective placeholder. |
[USER]: .spinner { |
margin: 100px auto; |
width: 50px; |
height: 40px; |
text-align: center; |
font-size: 10px; |
} |
.spinner > div { |
background-color: #333; |
height: 100%; |
width: 6px; |
display: inline-block; |
-webkit-animation: sk-stretchdelay 1.2s infinite ease-in-out; |
animation: sk-stretchdelay 1.2s infinite ease-in-out; |
} |
.spinner .rect2 { |
-webkit-animation-delay: -1.1s; |
animation-delay: -1.1s; |
} |
.spinner .rect3 { |
-webkit-animation-delay: -1.0s; |
animation-delay: -1.0s; |
} |
.spinner .rect4 { |
-webkit-animation-delay: -0.9s; |
animation-delay: -0.9s; |
} |
.spinner .rect5 { |
-webkit-animation-delay: -0.8s; |
animation-delay: -0.8s; |
} |
@-webkit-keyframes sk-stretchdelay { |
0%, 40%, 100% { -webkit-transform: scaleY(0.4) } |
20% { -webkit-transform: scaleY(1.0) } |
} |
@keyframes sk-stretchdelay { |
0%, 40%, 100% { |
transform: scaleY(0.4); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.