2

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.

enter image description here So, I want to remove this scroll bar but still be able to scroll.

Any help?

Pedram
  • 15,766
  • 10
  • 44
  • 73
Hasan Rony
  • 69
  • 1
  • 5

5 Answers5

3

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;
    }
pradeep kumar
  • 983
  • 10
  • 21
1

If you are using bootstrap version 4. You can use this css code.

.modal-scrollbar-measure {
overflow: hidden !Important; }
0

.modal class has overflow-y: scroll rule which results in scrollbar always visible. https://stackoverflow.com/a/18715220/9143855

0

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

adil khan
  • 11
  • 4
0

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/

cosminq
  • 51
  • 2
  • 8