Skip to content

Commit 79b7eaf

Browse files
authored
Update messages.html
Added planned feature
1 parent 24b0177 commit 79b7eaf

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

messages.html

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,52 @@
3030
box-sizing: border-box;
3131
}
3232

33+
/* The snackbar - position it at the bottom and in the middle of the screen */
34+
#snackbar {
35+
visibility: hidden; /* Hidden by default. Visible on click */
36+
min-width: 250px; /* Set a default minimum width */
37+
margin-left: -125px; /* Divide value of min-width by 2 */
38+
background-color: #333; /* Black background color */
39+
color: #fff; /* White text color */
40+
text-align: center; /* Centered text */
41+
border-radius: 2px; /* Rounded borders */
42+
padding: 16px; /* Padding */
43+
position: fixed; /* Sit on top of the screen */
44+
z-index: 1; /* Add a z-index if needed */
45+
left: 50%; /* Center the snackbar */
46+
bottom: 30px; /* 30px from the bottom */
47+
}
48+
49+
/* Show the snackbar when clicking on a button (class added with JavaScript) */
50+
#snackbar.show {
51+
visibility: visible; /* Show the snackbar */
52+
/* Add animation: Take 0.5 seconds to fade in and out the snackbar.
53+
However, delay the fade out process for 2.5 seconds */
54+
-webkit-animation: fadein 0.5s, fadeout 0.5s 2.5s;
55+
animation: fadein 0.5s, fadeout 0.5s 2.5s;
56+
}
57+
58+
/* Animations to fade the snackbar in and out */
59+
@-webkit-keyframes fadein {
60+
from {bottom: 0; opacity: 0;}
61+
to {bottom: 30px; opacity: 1;}
62+
}
63+
64+
@keyframes fadein {
65+
from {bottom: 0; opacity: 0;}
66+
to {bottom: 30px; opacity: 1;}
67+
}
68+
69+
@-webkit-keyframes fadeout {
70+
from {bottom: 30px; opacity: 1;}
71+
to {bottom: 0; opacity: 0;}
72+
}
73+
74+
@keyframes fadeout {
75+
from {bottom: 30px; opacity: 1;}
76+
to {bottom: 0; opacity: 0;}
77+
}
78+
3379
.menu-logo img {
3480
max-height: 40px;
3581
max-width: 100px;
@@ -138,6 +184,12 @@ <h1>Messages</h1>
138184

139185
<br>
140186

187+
<!-- Use a button to open the snackbar -->
188+
<button onclick="myFunction()">Message Staff</button>
189+
190+
<!-- The actual snackbar -->
191+
<div id="snackbar">This feature is Coming Soon!</div>
192+
141193
<center><h2>You currently don't have any messages. Check back later!</h2></center>
142194

143195

@@ -146,6 +198,16 @@ <h1>Messages</h1>
146198
var menu = document.querySelector('.menu');
147199
menu.style.display = menu.style.display === 'flex' ? 'none' : 'flex';
148200
}
201+
function myFunction() {
202+
// Get the snackbar DIV
203+
var x = document.getElementById("snackbar");
204+
205+
// Add the "show" class to DIV
206+
x.className = "show";
207+
208+
// After 3 seconds, remove the show class from DIV
209+
setTimeout(function(){ x.className = x.className.replace("show", ""); }, 3000);
210+
}
149211
</script>
150212
</body>
151213
</html>

0 commit comments

Comments
 (0)