Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make bootstrap dropdown be shown over a modal-footer instead of making modal overflow?

I have created a modal to allow users to add alarms, one alarm can have many notifications of different kinds, so I want the user to choose which kind of notification he wants via a dropdown.

You can see a (not 100% working) fiddle here: http://jsfiddle.net/renatoargh/teX7Y/

I am using Bootstrap version 2.3.2.

Basicaly what happens is shown in the pictures below:

1- Initial state

initial state

2- Broken state, with dropdown making modal overflow instead of appearing over it

enter image description here

I have tried setting a huge value to z-index of ul#dropdown-menu but it doesn't seems to work. Also I have tried changing the display property without success.

Can someone help me?

EDIT Opening the dropdown upwards (dropup) to the upside is also not an option since the problem occurs (when the screen is resized to desktop size); http://jsfiddle.net/hashem/teX7Y/1/

like image 806
Renato Gama Avatar asked Mar 07 '14 22:03

Renato Gama


People also ask

How to set the footer of the bootstrap modal?

To set the footer of the Bootstrap modal, use the .modal-footer class. You can try to run the following code to implement the modal-footer class −

What is the difference between modal body and footer?

The .modal-body class is used to define the style for the body of the modal. Add any HTML markup here; paragraphs, images, videos, etc. The .modal-footer class is used to define the style for the footer of the modal. Note that this area is right aligned by default.

How to change the size of the modal in Bootstrap JS?

Change the size of the modal by adding the .modal-sm class for small modals or .modal-lg class for large modals. Add the size class to the <div> element with class .modal-dialog: By default, modals are medium in size. For a complete reference of all modal options, methods and events, go to our Bootstrap JS Modal Reference.

What is the difference between modal-body and modal class?

The .close class styles the close button, and the .modal-title class styles the header with a proper line-height. The .modal-body class is used to define the style for the body of the modal. Add any HTML markup here; paragraphs, images, videos, etc. The .modal-footer class is used to define the style for the footer of the modal.


1 Answers

You can just add another class to your modal-body

 <div class="modal-body girlLookAtThatBody">

and of course

 .girlLookAtThatBody{
    overflow-y:inherit !important;
}

So check it:

http://jsfiddle.net/uUvyy/

Hope that helps!

like image 105
Bryce Easley Avatar answered Oct 06 '22 17:10

Bryce Easley