I'm having trouble with this particular process and haven't been successful so far...
I currently have a customized scrollbar within a div element, and what I am attempting to do is remove the scrollbar when the height of the div is less than 196px, and display the scrollbar when it exceeds 196px. Apologies for any language difficulties, and thank you for any assistance!
$(".scrollbar").scroll(function() {
var h = this.innerHeight;
if (h > 100) {
$(".cstm").addClass("scrollbar");
} else {
$('.cstm').removeClass("scrollbar");
}
});
.scrollbar {
height: 196px;
overflow-y: scroll;
padding: 4px;
}
#style-3::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
background-color: red;
}
#style-3::-webkit-scrollbar {
width: 4px;
background-color: #F5F5F5;
}
#style-3::-webkit-scrollbar-thumb {
background-color: #000000;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<div class="cstm scrollbar" id="style-3" style="display: block;">
<div class="my-box">
<div class="animated slideInUp" style="margin-bottom: -22px;font-size: 12px;background: #f5f5f5;color: #e60000;border-radius: 3px;padding: 2px;">
<center>
<i class="animated flash fa fa-times-circle"></i> INFO BOX 1
</center>
</div><br>
<div class="animated slideInUp" style="margin-bottom: -22px;font-size: 12px;background: #f5f5f5;color: #e60000;border-radius: 3px;padding: 2px;">
<center>INFO BOX 2 </center>
</div><br>
<div class="animated slideInUp" style="margin-bottom: -22px;font-size: 12px;background: #f5f5f5;color: #e60000;border-radius: 3px;padding: 2px;">
<center> ON FEW BOXES THE RED SCROLL TO BE REMOVED</center>
</div><br>
</div>
</div>