|
3 | 3 | <head>
|
4 | 4 | <meta charset="UTF-8">
|
5 | 5 | <meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
| - <title>Styled Iframe</title> |
| 6 | + <title>Styled Iframe with Spinner</title> |
7 | 7 | <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap" rel="stylesheet">
|
8 | 8 | <style>
|
9 |
| - /* Ensure the body and html elements take up the full height */ |
| 9 | + /* General resets and full viewport height */ |
10 | 10 | html, body {
|
11 | 11 | margin: 0;
|
12 | 12 | padding: 0;
|
|
17 | 17 | overflow: hidden; /* Prevent scrollbars */
|
18 | 18 | }
|
19 | 19 |
|
| 20 | + /* Ensures full overlay on top */ |
| 21 | + .fade-overlay { |
| 22 | + position: fixed; |
| 23 | + top: 0; |
| 24 | + left: 0; |
| 25 | + width: 100%; |
| 26 | + height: 100%; |
| 27 | + background-color: rgba(0, 0, 0, 1); /* Fully opaque black background */ |
| 28 | + opacity: 1; /* Initially visible */ |
| 29 | + transition: opacity 0.5s ease-out; /* Adjust timing and easing as needed */ |
| 30 | + z-index: 9999; /* Ensure it sits on top of other content */ |
| 31 | + display: flex; |
| 32 | + align-items: center; |
| 33 | + justify-content: center; |
| 34 | + pointer-events: none; /* Ensure clicks pass through to the iframe underneath */ |
| 35 | + } |
| 36 | + |
| 37 | + /* Adjustments to spinner */ |
| 38 | + .spinner { |
| 39 | + border: 8px solid rgba(0, 0, 0, 0.1); /* Light grey border */ |
| 40 | + border-radius: 50%; |
| 41 | + border-top: 8px solid #EFD500; /* Spinner color */ |
| 42 | + width: 10vw; /* Responsive width (10% of viewport width) */ |
| 43 | + height: 10vw; /* Responsive height (10% of viewport width) */ |
| 44 | + max-width: 100px; /* Maximum width */ |
| 45 | + max-height: 100px; /* Maximum height */ |
| 46 | + animation: spin 1s linear infinite; /* Adjust animation duration */ |
| 47 | + } |
| 48 | + |
| 49 | + @keyframes spin { |
| 50 | + 0% { transform: rotate(0deg); } |
| 51 | + 100% { transform: rotate(360deg); } |
| 52 | + } |
| 53 | + |
| 54 | + /* Adjustments for responsiveness */ |
| 55 | + @media (max-width: 768px) { |
| 56 | + .spinner { |
| 57 | + width: 10vw; /* Adjust size for smaller screens */ |
| 58 | + height: 10vw; |
| 59 | + max-width: 80px; /* Maximum width */ |
| 60 | + max-height: 80px; /* Maximum height */ |
| 61 | + } |
| 62 | + } |
| 63 | + |
20 | 64 | .iframe-container {
|
21 | 65 | position: absolute;
|
22 | 66 | top: 50%;
|
|
28 | 72 | border-radius: 12px; /* Rounded corners */
|
29 | 73 | box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3); /* Subtle shadow */
|
30 | 74 | overflow: hidden; /* Hide any overflow */
|
| 75 | + z-index: 1; /* Ensure it is beneath the spinner */ |
31 | 76 | }
|
32 | 77 |
|
33 | 78 | .iframe-container iframe {
|
|
38 | 83 | </style>
|
39 | 84 | </head>
|
40 | 85 | <body>
|
| 86 | + <div class="fade-overlay"> |
| 87 | + <div class="spinner"></div> |
| 88 | + </div> |
41 | 89 | <div class="iframe-container">
|
42 | 90 | <iframe scrolling="no" id="hearthis_at_user_myxxfm"
|
43 | 91 | src="https://app.hearthis.at/myxxfm/embed/?hcolor=ba9b00&css=&skin=black"
|
44 | 92 | frameborder="0" allowtransparency></iframe>
|
45 | 93 | </div>
|
| 94 | + <script> |
| 95 | + // Automatically fade out after a set time |
| 96 | + setTimeout(() => { |
| 97 | + const overlay = document.querySelector('.fade-overlay'); |
| 98 | + overlay.style.opacity = 0; |
| 99 | + // Optional: Remove overlay after fade-out to clean up |
| 100 | + setTimeout(() => { |
| 101 | + overlay.style.display = 'none'; |
| 102 | + document.body.style.overflow = 'auto'; // Restore scrollbars |
| 103 | + }, 500); // Adjust the total duration before fading out |
| 104 | + }, 2000); // Adjust the time before starting fade-out (reduced to 2 seconds) |
| 105 | + </script> |
46 | 106 | </body>
|
47 | 107 | </html>
|
0 commit comments