|
15 | 15 | /* Cookie banner styling */
|
16 | 16 | #cookie-banner {
|
17 | 17 | position: fixed;
|
18 |
| - bottom: 0; |
| 18 | + bottom: -100px; /* Initially hide the banner off-screen */ |
| 19 | + left: 0; |
19 | 20 | width: 100%;
|
20 | 21 | background-color: #333;
|
21 | 22 | color: white;
|
22 | 23 | text-align: center;
|
23 |
| - padding: 10px; |
| 24 | + padding: 15px; |
24 | 25 | display: none;
|
25 | 26 | z-index: 1000;
|
| 27 | + border-top-right-radius: 10px; |
| 28 | + border-top-left-radius: 10px; |
| 29 | + box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1); |
| 30 | + transition: bottom 0.5s ease-in-out; /* Slide-in effect */ |
26 | 31 | }
|
27 | 32 | #cookie-banner button {
|
28 | 33 | background-color: #4CAF50;
|
@@ -79,13 +84,19 @@ <h1>Welcome to Our School SMP!</h1>
|
79 | 84 | function checkCookieConsent() {
|
80 | 85 | if (!localStorage.getItem('cookiesAccepted')) {
|
81 | 86 | document.getElementById('cookie-banner').style.display = 'block';
|
| 87 | + setTimeout(function() { |
| 88 | + document.getElementById('cookie-banner').style.bottom = '0'; // Animate the banner from below |
| 89 | + }, 100); // Short delay before sliding in |
82 | 90 | }
|
83 | 91 | }
|
84 | 92 |
|
85 | 93 | // Function to handle the acceptance of cookies
|
86 | 94 | document.getElementById('accept-cookies').addEventListener('click', function() {
|
87 | 95 | localStorage.setItem('cookiesAccepted', 'true'); // Store cookie consent in localStorage
|
88 |
| - document.getElementById('cookie-banner').style.display = 'none'; // Hide the banner |
| 96 | + document.getElementById('cookie-banner').style.bottom = '-100px'; // Hide the banner by sliding it out |
| 97 | + setTimeout(function() { |
| 98 | + document.getElementById('cookie-banner').style.display = 'none'; // Completely hide it after animation |
| 99 | + }, 500); // Wait for the slide-out animation to finish |
89 | 100 | });
|
90 | 101 |
|
91 | 102 | // Check cookie consent status on page load
|
|
0 commit comments