I have build the below CSS and jQuery, that display some additional info on hover/mouseenter, however I have dificulties getting the font awsome icons on the siblings to hide when I hover over one of the DIV, and the text that I swap the icons with on mouseenter is "jumping" and I cannot get it to display correct (i.e. the <br> is very large)
How can I:
- Get the icons on siblings to stay in the back on mouseenter?
- How do I get the text swapped to "normalize" so that it will display as it should (i.e the
<br>to break line normally and not "jumping")?
My code :
$("#SystemInfodiv1").mouseenter(function() {
$("#SystemInfodiv1").removeClass("pulse red");
$("#SystemInfoText1").html("<b>Last Database Backup:</b><br>20-05-2021 01:16:24");
});
$("#SystemInfodiv1").mouseleave(function() {
$("#SystemInfoText1").html("<i class='fas fa-database'></i>");
});
$("#SystemInfodiv2").mouseenter(function() {
$("#SystemInfodiv2").even().removeClass("pulse red");
$("#SystemInfoText2").html("<b>Database Size:</b><br>3.87 GB of 6.13 GB used storage");
});
$("#SystemInfodiv2").mouseleave(function() {
$("#SystemInfoText2").html("<i class='far fa-hdd'></i>");
});
$("#SystemInfodiv3").mouseenter(function() {
$("#SystemInfodiv3").even().removeClass("pulse red");
$("#SystemInfoText3").html("<b>Last sync with AD:</b><br>21-05-2021 07:00:04");
});
$("#SystemInfodiv3").mouseleave(function() {
$("#SystemInfoText3").html("<i class='fas fa-sync-alt'></i>");
});
#SystemInfoTable {
position: absolute;
top: -10px;
right: 190px;
z-index: 10;
width: 100px;
}
.SystemInfodiv {
width: 40px;
height: 40px;
transition-property: width height;
transition-duration: 0.5s;
z-index: 10;
font-size: 10px;
border-radius: 20px;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
text-align: center;
}
.SystemInfodiv:hover {
z-index: 100;
}
.SystemInfodiv:hover {
width: 80px;
height: 25px;
transform: scale(4);
border-radius: 5px;
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
cursor: pointer;
text-align: center;
}
.SystemInfoText {
position: relative;
z-index: 10;
top: 10px;
color: white;
font-size: 17px;
transition-property: all;
transition-duration: 0.5s;
}
.SystemInfoText:hover {
top: 5px;
z-index: 15;
font-size: 4px;
}
.pulse.red {
background: rgba(255, 82, 82, 1);
box-shadow: 0 0 0 0 rgba(255, 82, 82, 1);
animation: pulse-red 2s infinite;
}
@keyframes pulse-red {
0% {
transform: scale(0.95);
box-shadow: 0 0 0 0 rgba(255, 82, 82, 0.7);
}
70% {
transform: scale(1);
box-shadow: 0 0 0 10px rgba(255, 82, 82, 0);
}
100% {
transform: scale(0.95);
box-shadow: 0 0 0 0 rgba(255, 82, 82, 0);
}
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<script src="https://kit.fontawesome.com/7fa152c719.js" crossorigin="anonymous"></script>
<table id="SystemInfoTable">
<tr style="border-bottom: 0px solid #FFFFFF;">
<td valign="bottom">
<div id="SystemInfodiv1" class="SystemInfodiv bg-success"><span id="SystemInfoText1" class="SystemInfoText"><i class="fas fa-database"></i></span></div>
</td>
<td valign="bottom">
<div id="SystemInfodiv2" class="SystemInfodiv bg-warning"><span id="SystemInfoText2" class="SystemInfoText"><i class="far fa-hdd"></i></span></div>
</td>
<td valign="bottom">
<div id="SystemInfodiv3" class="SystemInfodiv bg-danger pulse red"><span id="SystemInfoText3" class="SystemInfoText"><i class="fas fa-sync-alt"></i></span></div>
</td>
</tr>
</table>