create snackbar using html HTML
<!-- HTML2 -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Snack Template</title>
<link rel="stylesheet" href="./styles/style.css" />
<script>
<!-- HTML 1 -->
const temps = [];
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<!-- HTML 4 -->
<style>
@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap");
* {
font-family: poppins;
padding: 0;
margin: 0;
box-sizing: border-box;
}
.display-none {
display: none !important;
}
.snackbar-card-container {
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
}
.snackbar-card-text {
font-weight: 400;
font-size: 13px;
color: white;
}
#snackbar {
visibility: hidden;
cursor: pointer;
min-width: 250px;
margin-left: -125px;
background-color: green;
color: #fff;
text-align: center;
border-radius: 2px;
padding: 16px;
position: fixed;
z-index: 1;
right: 1%;
bottom: 1%;
font-size: 17px;
}
#snackbar.show {
visibility: visible;
-webkit-animation: fadein_snackbar 0.5s, fadeout_snackbar_snackbar 0.5s 2.5s;
animation: fadein_snackbar 0.5s, fadeout_snackbar 0.5s 2.5s;
}
@-webkit-keyframes fadein_snackbar {
from {bottom: 0; opacity: 0;}
to {bottom: 1%; opacity: 1;}
}
@keyframes fadein_snackbar {
from {bottom: 0; opacity: 0;}
to {bottom: 1%; opacity: 1;}
}
@-webkit-keyframes fadeout_snackbar {
from {bottom: 1%; opacity: 1;}
to {bottom: 0; opacity: 0;}
}
@keyframes fadeout_snackbar {
from {bottom: 1%; opacity: 1;}
to {bottom: 0; opacity: 0;}
}
</style>
</head>
<body>
<div class="snackbar" id="snackbar">
<div class="job-container">
<div class="snackbar-card-container">
<div class="snackbar-card-text">You need to login to do this manipulation!</div>
</div>
</div>
</div>
<!-- Where you put HTML custom and style CSS -->
<script src="app.js"></script>
<!-- HTML 3 -->
<script>
let snackbar = $('#snackbar');
if (!snackbar.hasClass('show')) {
snackbar.addClass('show');
setTimeout(function() {
snackbar.removeClass('show');
}, 1500);
}
</script>
</body>
</html>