My modal-body has two div side by side, one of them must have a scrollbar if his content is too big for the modal. Unfortunately, the scrollbar appears on the modal-body, not on my div.
What I have:
What I want:
My panelGuest has the overflow-y
to auto, I tried with 'scroll' instead but the scrollbar is shown but not available. I tried different values for overflow on the modal-body, in vain.
css:
#panelGuest{
overflow-y:auto;
overflow-x:hidden;
width: 35%;
float:left;
border-right:solid #ff920a 2px;
min-height:100px;
}
html:
<div id="modalShareBody" class="modal-body">
<div id="panelGuest" class="panel">
The div where i want the y-scrollbar
</div>
<div id="panelDetail" class="panel">
</div>
</div>
Here a fiddle with the issue: http://jsfiddle.net/Ua2HM/2/
For vertical scrollable bar use the x and y axis. Set the overflow-x:hidden; and overflow-y:auto; that will automatically hide the horizontal scroll bar and present only vertical scrollbar. Here the scroll div will be vertically scrollable.
Use the . modal-dialog-scrollable class to enable scrolling inside the modal.
It is very simple to make bootstrap modal scrollable, you just need to add max-height, overfolw-y to add scrollbar in Modal content.
In HTML, there is a division container - or <div></div> - that can encapsulate HTML data and elements. This data can then be manipulated using CSS styling and JavaScript. Among other features, you can also add a scrollbar to your div container with CSS.
I did it making the height of the modal a fixed value:
#modalShare {
margin-left:-200px;
height: 300px;
}
@media (max-width: 767px) {
#modalShare {
width: auto;
margin-left: auto;
}
}
#modalShareBody {
overflow:hidden;
}
#panelGuest{
width: 35%;
float:left;
height: 200px;
overflow-y: auto;
overflow-x: hidden;
border-right:solid #ff920a 2px;
}
#panelDetail{
float:left;
width: 60%;
}
Is that what you need?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With