When I interact with the collapsible card, it has a jerky animation. I would like it to open smoothly instead.
The issue lies with the tooltip-cus
class. If I remove position: relative;
, the opening animation is smooth, but then the position of the tooltip is incorrect when hovering over the product name.
In addition, I would like to include headings for the product count and price, aligning them neatly beneath each other.
h5 {
font-size: 20px;
}
.group-card {
background-color: #3B506C;
border-radius: 10px;
}
.product-item {
border-top: 1px solid #183150;
}
.product-item:first-child {
margin-top: 30px;
}
.tooltip-cus:hover .tooltiptext-cus {
visibility: visible;
}
.tooltip-cus .tooltiptext-cus {
visibility: hidden;
width: 280px;
background-color: black;
color: #fff;
text-align: center;
border-radius: 6px;
padding: 5px 0;
/* Position the tooltip */
position: absolute;
z-index: 1;
}
.tooltip-cus {
position: relative;
display: inline-block;
font-weight: 500;
}
.tooltiptext-cus {
top: 10px;
left: 100px;
font-size: 16px;
font-weight: 400;
}
<!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>Document</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<link rel="stylesheet" href="assets/style.css">
</head>
<body>
<div class="container">
<div class="row">
<div class="col-lg-6 col-md-12 col-sm-12 col-xs-12">
<div style="" class="mb-4 ml-3 p-4 group-card">
<div class="row align-items-center">
<div class="col-sm-12 ">
<div class="media">
<div class="media-body align-self-center">
<h5 class="m-0">
My products
</h5>
</div>
</div>
<a href="#" data-toggle="collapse" data-target="#stretched-content" class="stretched-link collapsed" aria-expanded="false"></a>
</div>
</div>
<div class="collapse" id="stretched-content">
<div class="product-item py-3">
<div class="tooltip-cus">
<p class="mb-0">Product 1</p>
<span class="tooltiptext-cus">
This is product 1 description
</span>
</div>
<span class="badge badge-primary float-right">$2.99</span>
<span class="badge badge-primary float-right mr-2">20</span>
</div>
<div class="product-item py-3">
<div class="tooltip-cus">
<p class="mb-0">Product 2</p>
<span class="tooltiptext-cus">
This is product 2 description
</span>
</div>
<span class="badge badge-primary float-right">$32.99</span>
<span class="badge badge-primary float-right mr-2">20</span>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
</body>
</html>