Contents
How to put scroll bar only for modal-body?
For Bootstrap versions >= 4.3 Bootstrap 4.3 added new built-in scroll feature to modals. This makes only the modal-body content scroll if the size of the content would otherwise make the page scroll. To use it, just add the class modal-dialog-scrollable to the same div that has the modal-dialog class.
Why does page not scroll when modal is open?
This works, but there’s still a little leakage here after the modal is closed. Specifically, it appears that the page already loses its scroll position when the modal is open and the body set to be fixed. So we have to retrieve the location. Let’s modify our JavaScript to account for that. That does it!
Why does bootstrap hide the scroll bar when it is opened?
If your page is somewhat long, it will automatically provide a scroll bar. And when the modal opened, it will hide the scroll bar because that’s what bootstrap do as a default. To avoid hiding it when modal is opened, just override it by putting the css code (below) on your own css file.
Why does the scroll bar disappear in JavaScript?
When I trigger a modal view in my page it triggers the scroll bar to disappear. It’s an annoying effect because the background page starts moving when the modal moves in / disappears. Is there a cure for that effect?
Why does scrolling get disabled in jQuery Stack Overflow?
I have a modal and within that modal, there is a dropdown that displays large hidden content, which is working. Now when you open the next modal, stacked on top of the first modal and dismiss it, the scrolling on modal underneath becomes disabled.
What happens to scroll position when bootstrap modal closes?
It basically just stores your current scroll position in addition to setting “overflow” to “hidden” on the page body, then restores the scroll position after the modal closes. There’s a condition in there for when another bootstrap modal opens while one is already active.
Is there a way to hide the scroll bar in Bootstrap?
Do not Alter the css file of bootstrap because it will change everything in your bootstrap once you use it in other parts of your page. If your page is somewhat long, it will automatically provide a scroll bar. And when the modal opened, it will hide the scroll bar because that’s what bootstrap do as a default.