admin管理员组

文章数量:1287790

I have searched the web and I have failed to find a solution to adding a scroll to a bootbox custom dialog. Is there anyway I could get it to work. I need a vertical scroll.

Is this possible?

I have searched the web and I have failed to find a solution to adding a scroll to a bootbox custom dialog. Is there anyway I could get it to work. I need a vertical scroll.

Is this possible?

Share Improve this question edited Mar 13, 2016 at 19:12 Abbas Amiri 3,2141 gold badge25 silver badges24 bronze badges asked Mar 13, 2016 at 17:35 KyadKyad 1293 silver badges13 bronze badges 1
  • please add some sample code to your question, illustrating where you are stuck – Noam Hacker Commented Mar 13, 2016 at 18:06
Add a ment  | 

2 Answers 2

Reset to default 8

Bootbox uses a css class named modal-body for the body of its dialog; so you can override the class to make it scroll-able. For instance:

.modal-body {
    height: 100px;
    overflow-y: scroll;
}

If you want your dialog to expand and add scrollbars based on the size of your content, use this:

.modal-body { 
   max-height: 500px; 
   overflow-y: auto; 
}

That sets the maximum height, after which the scrollbar is added. So if you have little content, no bar and height adjusts to fix. If you have lots of content, you get a scrollbar and the height doesn't get too crazy high.

本文标签: javascriptHow to add a scroll to bootbox dialogStack Overflow