🔥 ANIME GIF HEAVEN 🔥
The ultimate collection of high-quality anime GIFs. Daily updates with the best moments from your favorite series!
×
// Replace these placeholder URLs with your actual GIF URLs
const gifUrls = [
"https://example.com/your-gif1.gif",
"https://example.com/your-gif2.gif",
"https://example.com/your-gif3.gif",
"https://example.com/your-gif4.gif",
"https://example.com/your-gif5.gif",
"https://example.com/your-gif6.gif"
// Add more GIF URLs here
];
const gifGallery = document.getElementById('gifGallery');
const playAllBtn = document.getElementById('playAll');
const pauseAllBtn = document.getElementById('pauseAll');
const shuffleBtn = document.getElementById('shuffle');
// Load GIFs into the gallery
function loadGifs() {
gifGallery.innerHTML = '';
gifUrls.forEach((url, index) => {
const gifItem = document.createElement('div');
gifItem.className = 'gif-item';
const img = document.createElement('img');
img.src = url;
img.alt = `Anime GIF ${index + 1}`;
img.loading = 'lazy';
const info = document.createElement('div');
info.className = 'gif-info';
info.textContent = `Anime GIF ${index + 1}`;
gifItem.appendChild(img);
gifItem.appendChild(info);
gifGallery.appendChild(gifItem);
});
}
// Play all GIFs (for GIFs that support controls)
function playAllGifs() {
const gifImages = document.querySelectorAll('.gif-item img');
gifImages.forEach(img => {
// This works for GIFs with controls or can be reloaded to play
const src = img.src;
img.src = '';
setTimeout(() => { img.src = src; }, 100);
});
alert('All GIFs are now playing!');
}
// Pause all GIFs (by replacing with static image if available)
function pauseAllGifs() {
alert('GIF pausing requires specific GIF formats. For standard GIFs, they will stop on next loop completion.');
}
// Shuffle GIF positions
function shuffleGifs() {
const gifItems = Array.from(document.querySelectorAll('.gif-item'));
gifGallery.innerHTML = '';
// Shuffle array
for (let i = gifItems.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[gifItems[i], gifItems[j]] = [gifItems[j], gifItems[i]];
}
// Append shuffled items
gifItems.forEach(item => gifGallery.appendChild(item));
}
// Event listeners
playAllBtn.addEventListener('click', playAllGifs);
pauseAllBtn.addEventListener('click', pauseAllGifs);
shuffleBtn.addEventListener('click', shuffleGifs);
// Initialize gallery when page loads
window.addEventListener('DOMContentLoaded', loadGifs);
// Optional: Add more GIFs button functionality
const addMoreBtn = document.createElement('button');
addMoreBtn.textContent = 'Load More GIFs';
addMoreBtn.className = 'btn';
addMoreBtn.style.marginTop = '10px';
addMoreBtn.addEventListener('click', () => {
// You can extend this to load more GIFs from your collection
alert('To load more GIFs, add URLs to the gifUrls array in script.js');
});
document.querySelector('.controls').appendChild(addMoreBtn);