Bootstrap-vue: Scroll body of modal with fixed header?

Created on 14 Nov 2017  路  3Comments  路  Source: bootstrap-vue/bootstrap-vue

Is it possible to do something like this with a long modal, where the header remains fixed while the body of the modal scrolls? See: https://github.com/keaukraine/bootstrap4-fs-modal

Answered Question

Most helpful comment

You can use some custom CSS to target .modal-body to restrict the height and set overflow-y: scroll

.my-modal .modal-body {
  max-height: 80vh; /* max 80% of the viewport height */
  overflow-y: auto;
}

and then set my-modal class on b-modal:

<b-modal class="my-modal" title="Foobar">
   Scrollable body with long content
</b-modal>

All 3 comments

You can use some custom CSS to target .modal-body to restrict the height and set overflow-y: scroll

.my-modal .modal-body {
  max-height: 80vh; /* max 80% of the viewport height */
  overflow-y: auto;
}

and then set my-modal class on b-modal:

<b-modal class="my-modal" title="Foobar">
   Scrollable body with long content
</b-modal>

Thanks! Works great! And thanks a lot for bootstrap-vue in general. Excellent work, and very useful.

You may need to adjust the max-height depending on the heights of your modal header and footer, but 80vh is useful in most situations. You may need to test it out on small screen devices (like phones/tablets)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ronjouch picture ronjouch  路  3Comments

MikeJWms picture MikeJWms  路  3Comments

developius picture developius  路  3Comments

alvirtuoso picture alvirtuoso  路  3Comments

ebertti picture ebertti  路  3Comments