I have created a webpage for my thymeleaf-based Spring Boot project with various cards. Here is the code snippet:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Card</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container-fluid">
<h2>Cards Columns</h2>
<div class="body-content" id="mainBody">
<div class="row">
<div class="col-sm-3 mb-3 mb-md-0 fixed-bottom sticky-top" style="padding-left: 50px;padding-right: 20px;padding-top: 10px;padding-bottom: 50px;">
...
</div>
<div class="col-sm-9" style="padding-left: 20px;padding-right: 100px;padding-top:10px;padding-bottom: 50px;">
...
</div>
</div>
</div>
</div>
</div>
</body>
</html>
Currently, I am trying to make the Document Summary card sticky on scroll so that its values are always visible.
I attempted using classes like `sticky-top` and `sticky-bottom`, along with modifying the CSS as shown below:
.make-me-sticky {
position: sticky;
top: 0;
}
Previously, it worked fine with the `affix` class, but after upgrading to Bootstrap 4, I encountered issues making it work. It seems to be incompatible with the card element or there might be something I am missing.
I am looking for a CSS solution rather than resorting to JavaScript to achieve this functionality.