I have a bootstrap modal popup on my page. The popup is a bit long so html adds the vertical scroll bar which doesn't look so good with the animation effect.
So, I want to remove this scroll bar but still be able to scroll.
Any help?
I have a bootstrap modal popup on my page. The popup is a bit long so html adds the vertical scroll bar which doesn't look so good with the animation effect.
So, I want to remove this scroll bar but still be able to scroll.
Any help?
It may help you. Fixing the overflow hidden will remove the scrollbar, To get full content within the page use overflow auto to modal body
CSS:
.modal{
overflow:hidden;
}
.modal-body{
overflow:auto;
}
If you are using bootstrap version 4. You can use this css code.
.modal-scrollbar-measure {
overflow: hidden !Important; }
.modal
class has overflow-y: scroll
rule which results in scrollbar always visible.
https://stackoverflow.com/a/18715220/9143855
that because you use overflow : scroll ; the scroll value of overflow property add scroll ball line to both sides vertically and horizontally you should use instead overflow auto which will just add one side scroll for which it needed the most
You can also use the modal events for this:
$("#modalID").on('shown.bs.modal', function(){
/* Hide the body scrollbar. */
document.body.style.overflow = "hidden";
});
$("#modalID").on('hidden.bs.modal', function(){
/* Show the body scrollbar. */
document.body.style.overflow = "auto";
});
the events can be seen here: https://mdbootstrap.com/docs/jquery/modals/events/