Below is the HTML code snippet:
<div id="menu_status_item">
<span class="menu_status_bar"></span>
</div>
Here is the CSS code:
#menu_status_item
{
margin-top: 40px;
width: 100%;
}
.menu_status_bar
{
margin-left: 45px;
color: #fff;
}
And the jQuery section:
var statusMessage = 'Success'
var colorCode = '';
var statusText = '';
if(statusMessage.indexOf("Success") > -1) {
colorCode = '#33CC33';
statusText = 'Success';
}else{
colorCode = '#CC0000';
statusText = 'Failure';
}
$(".menu_status_bar").css("display", "inline-table");
$(".menu_status_bar").text(statusText);
$("#menu_status_item").animate({backgroundColor: colorCode}, 4000);
$("#menu_status_item").animate({backgroundColor: "#ffffff"});
$(".menu_status_bar").css("display", "none");
I am trying to make the text "Success" appear inside menu_status_bar, do an animation, and then disappear by using display: none.
However, I am facing an issue where the text won't show up if I use display: none at the end. If I remove it, the animation works, but the text remains visible. This is a problem if someone tries to select the text as it gets highlighted.
Does anyone have any suggestions on how I can achieve the same result in a different way?
Thank you.