Greetings! I have created an animation using Jquery
However, I am facing an issue where the .text is visible while my info span is appearing and disappearing
I need to retain that class in my .alert span
In essence, what I am aiming to achieve is to make the text class white in an invisible alert box as it appears and disappears
Below is my code. Apologies for any language errors.
wiro_notify
$(document).ready(function () {
$("body").html(
'<span class="alert" id="success"><i class="fal fa-check icon"></i><span class="text"></span></span>'
);
$(".text").text("Successful");
var width = String($(".text").width() + 105) + "px";
var min = $(".text").width() + 105;
$("#success").animate({ bottom: "25%" }, 1000);
if (min < 200) {
$("#success").animate({ width: "200px" }, 1000);
$(".text").css("margin-left", "10px");
} else {
$("#success").animate({ width: width, "margin-left": "5px" }, 1000);
$(".text").css("margin-left", "7px");
}
$("#success").delay(4000).animate({ width: "80px" }, 1000);
$("#success").animate({ bottom: "0", "min-width": "80px" }, 1000);
});
* {
margin: 0;
padding: 0;
color: white;
}
body {
width: 100%;
height: 120vh;
display: flex;
justify-content: center;
position: relative;
overflow: hidden;
background-color: black;
}
.alert {
width: 80px;
height: 80px;
border-radius: 40px;
position: absolute;
bottom: 0;
}
.icon {
width: 80px;
height: 80px;
border-radius: 40px;
text-align: center;
font-size: 50px;
padding-top: 15px;
box-sizing: border-box;
}
.fa-check {
background-color: rgb(3, 182, 3);
}
#success {
background-color: rgb(0, 153, 0);
}
.text {
margin-left: 7px;
font-size: 30px;
text-align: center;
position: absolute;
bottom: 32%;
white-space: nowrap;
font-family: "Source Sans Pro", sans-serif;
}
<link rel="preconnect" href="https://fonts.gstatic.com" />
<link
href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro&display=swap"
rel="stylesheet"
/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<body></body>