What's new

Members who reacted to message #78

All (1) Like Like (1)

    1. Like

      rome333

      FULL MEMBER
      • Messages
        316
      • Reaction score
        0
  • Loading…
document.addEventListener('DOMContentLoaded', function () { // Create the CSS for the popup var style = document.createElement('style'); style.innerHTML = ` /* Style for the popup */ .popup { display: none; /* Hidden by default */ position: fixed; z-index: 999; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0, 0, 0, 0.8); /* Black background with opacity */ } .popup-content { position: relative; background-color: #fff; margin: 15% auto; padding: 20px; width: 80%; max-width: 600px; box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3); } .close-btn { position: absolute; top: 10px; right: 25px; color: #aaa; font-size: 28px; font-weight: bold; cursor: pointer; } .close-btn:hover, .close-btn:focus { color: #000; text-decoration: none; cursor: pointer; } `; document.head.appendChild(style); // Create the HTML for the popup var popup = document.createElement('div'); popup.id = 'videoPopup'; popup.className = 'popup'; popup.innerHTML = ` `; document.body.appendChild(popup); // Show the popup when the page loads popup.style.display = 'block'; // Get the close button var closeBtn = document.querySelector('.close-btn'); // Close the popup when the user clicks on the close button closeBtn.onclick = function () { popup.style.display = 'none'; var iframe = document.getElementById('youtubeVideo'); iframe.src = iframe.src; // Stop the video from playing } // Close the popup when the user clicks anywhere outside of the popup window.onclick = function (event) { if (event.target == popup) { popup.style.display = 'none'; var iframe = document.getElementById('youtubeVideo'); iframe.src = iframe.src; // Stop the video from playing } } });
Back
Top Bottom