/engine/rtp/website/jaringslot/toptrendgaming/') .then(response => response.json()) .then(data => { const gameList = document.getElementById('gameList'); const lightboxWrapper = document.getElementById('lightboxWrapper'); const lightbox = document.getElementById('lightbox-game'); const searchInput = document.getElementById('searchInput'); // Iterate through the data items and generate HTML data.items.forEach(item => { const gameCard = document.createElement('div'); gameCard.className = 'card'; const cardContent = document.createElement('div'); cardContent.className = 'card-content'; // Create the "hover-btn" div const hoverBtn = document.createElement('div'); hoverBtn.className = 'hover-btn'; // Add a click event listener to open the lightbox when the "Card" is clicked gameCard.addEventListener('click', () => openLightbox(item)); const playBtn = document.createElement('div'); playBtn.className = 'play-btn'; playBtn.textContent = 'TIPS & POLA'; // Append the "play-btn" div to the "hover-btn" div hoverBtn.appendChild(playBtn); const imgZoom = document.createElement('img'); imgZoom.className = 'img-zoom'; imgZoom.src = item.game_image; imgZoom.alt = item.game_name; const percent = document.createElement('div'); percent.className = 'percent'; const percentText = document.createElement('p'); percentText.textContent = `${item.rtp}%`; const percentBar = document.createElement('div'); percentBar.className = `percent-bar ${item.progress_color}`; percentBar.setAttribute('role', 'progressbar'); percentBar.setAttribute('aria-valuemin', '0'); percentBar.setAttribute('aria-valuemax', '100'); percentBar.setAttribute('aria-valuenow', item.rtp); percentBar.style.width = `${item.rtp}%`; percent.appendChild(percentText); percent.appendChild(percentBar); cardContent.appendChild(hoverBtn); // Append "hover-btn" div instead of "play-btn" cardContent.appendChild(imgZoom); cardContent.appendChild(percent); gameCard.appendChild(cardContent); gameList.appendChild(gameCard); }); // Event listener to close the lightbox when clicking outside the lightbox lightboxWrapper.addEventListener('click', (event) => { if (event.target === lightboxWrapper) { closeLightbox(); } }); }) .catch(error => { console.error('Error fetching data:', error); }); // Function to open the lightbox for a specific game function openLightbox(item) { const lightboxWrapper = document.getElementById('lightboxWrapper'); const lightbox = document.getElementById('lightbox-game'); // Populate the lightbox content with data from the item lightbox.innerHTML = `
${item.game_name} ${item.game_name} ${item.game_name}
${item.game_name}
${item.rtp}%
SENSATIONAL

${item.rtp}%

agen slot gacor terbaik
POLA RTP KHUSUS JARINGSLOT:
Spin Pola
${item.tips_1_spin} ${item.tips_1_pola}
${item.tips_2_spin} ${item.tips_2_pola}
${item.tips_3_spin} ${item.tips_3_pola}

`; // Show the lightbox and its overlay with fade-in animation lightboxWrapper.style.display = 'block'; lightboxWrapper.classList.add('fade-in'); // Add fade-in animation class // Add a click event listener to close the lightbox const closeButton = document.getElementById('close-button'); closeButton.addEventListener('click', () => closeLightbox()); } // Function to close the lightbox with fade-out animation function closeLightbox() { const lightboxWrapper = document.getElementById('lightboxWrapper'); // Add fade-out animation class before hiding the lightbox lightboxWrapper.classList.add('fade-out'); // Set a timeout to hide the lightbox after the animation completes setTimeout(() => { lightboxWrapper.style.display = 'none'; lightboxWrapper.classList.remove('fade-out'); // Remove fade-out animation class }, 500); // Adjust the timeout duration to match your animation duration } });