pug555

หน้าหลัก

รวมเกมส์ทดลองเล่นสล็อตค่าย Pragmatic Play

/* Your CSS styles */ .image-gallery { display: flex; flex-wrap: wrap; } .gallery-item { flex: 1 0 25%; padding: 5px; } .gallery-item img { max-width: 100%; height: auto; cursor: pointer; } .modal { display: none; position: fixed; z-index: 1; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0, 0, 0, 0.8); justify-content: center; align-items: center; display: flex; flex-direction: column; /* Center content vertically */ } /* Add a max-width for responsiveness */ .modal-content { max-width: 80%; /* Adjust this value as needed */ background-color: #fefefe; padding: 20px; border: 1px solid #888; border-radius: 8px; text-align: center; } /* Add media query for smaller screens */ @media screen and (max-width: 600px) { .modal-content { max-width: 100%; /* Adjust this value for smaller screens */ } } .close { color: #aaa; float: right; font-size: 28px; font-weight: bold; cursor: pointer; } .close:hover, .close:focus { color: black; text-decoration: none; cursor: pointer; } .image-name { text-align: center; margin-top: 5px; } .modal-content { background-color: #fefefe; margin: 10% auto; padding: 20px; border: 1px solid #888; max-width: 80%; /* Изменили ширину модального окна */ position: relative; text-align: center; /* Центрирование содержимого */ } iframe { width: 100%; height: 500px; border: none; } document.addEventListener('DOMContentLoaded', function() { const images = document.querySelectorAll('.gallery-item img'); const modal = document.getElementById('iframeModal'); const closeBtn = document.querySelector('.close'); images.forEach(function(image) { image.addEventListener('click', function() { const src = this.parentElement.getAttribute('data-src'); modal.querySelector('iframe').src = src; modal.style.display = 'flex'; // Changed 'block' to 'flex' for better centering }); }); closeBtn.addEventListener('click', function() { modal.style.display = 'none'; modal.querySelector('iframe').src = ''; }); window.addEventListener('click', function(event) { if (event.target == modal) { modal.style.display = 'none'; modal.querySelector('iframe').src = ''; } }); });