text stringlengths 0 106k |
|---|
-webkit-transform: scaleY(0.4); |
} 20% { |
transform: scaleY(1.0); |
-webkit-transform: scaleY(1.0); |
} |
} |
async function generateImages() { |
// Get the values from the form inputs |
let provider = document.getElementById('provider').value; |
let model = document.getElementById('model').value; |
let style = document.getElementById('style').value; |
let ratio = document.getElementById('ratio').value; |
let numImages = document.getElementById('num-images').value; |
// Generate the URLs |
let urls = []; // |
for (let i = 0; i < numImages; i++) { |
urls.push('http://example.com/image' + i + '.jpg'); |
} |
urls = ["https://i.ibb.co/k0W6V1v/Dream-Shaper-v7-blonde-hermione-emma-watsonpink-dress-silver-ti-3.jpg", |
"https://i.ibb.co/4tVHbcq/Dream-Shaper-v7-blonde-hermione-emma-watsonpink-dress-silver-ti-2.jpg", |
"https://i.ibb.co/wLzpXb2/Photo-Real-blonde-hermione-emma-watsonpink-dress-blushing-weddi-0.jpg", |
"https://i.ibb.co/pjbT6Gd/Photo-Real-blonde-hermione-emma-watsonpink-dress-silver-tiara-b-1.jpg"] |
// Display the placeholders |
let imageContainer = document.createElement('div'); |
imageContainer.style.display = 'flex'; |
imageContainer.style.flexWrap = 'wrap'; |
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 |
} |
}); |
} |
The loading animation is not centered inside each image, also there is no elapsed time below it in seconds |
[AI]: My apologies for the oversight. Let's add a container for the spinner and the elapsed time, so we can center the spinner within this container. We will also add a timer that updates every second to display the elapsed time. |
Here's the updated code: |
```javascript |
async function generateImages() { |
// Get the values from the form inputs |
let provider = document.getElementById('provider').value; |
let model = document.getElementById('model').value; |
let style = document.getElementById('style').value; |
let ratio = document.getElementById('ratio').value; |
let numImages = document.getElementById('num-images').value; |
// Generate the URLs |
let urls = []; // |
for (let i = 0; i < numImages; i++) { |
urls.push('http://example.com/image' + i + '.jpg'); |
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.