Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Making Bootstrap modal resizable with jQuery UI issue

So I have a Bootstrap modal I've created and I am trying to make it resizable using jquery. I have the resize working horizontally but if you try to resize vertically its like the content inside of the modal is not contained within the element I am trying to resize.

I tried using the 'alsoResize' property on the .resizable() and included all the divs within the modal but that seems to cause other issues.

$('.modal-content').resizable({
    alsoResize: ".modal-header, .modal-body, .modal-footer"
});

Here is my example: https://jsfiddle.net/p7o2mkg4/

like image 617
user3618473 Avatar asked Oct 06 '15 15:10

user3618473


People also ask

How can I increase bootstrap modal size?

Change the size of the modal by adding the . modal-sm class for small modals, . modal-lg class for large modals, or . modal-xl for extra large modals.

Is bootstrap modal responsive?

Bootstrap modals are supposed to be responsive by default. Something to look out for is if you have a width set on your Modal.


1 Answers

You actually did everything right! But the default overflow behaviour of HTML elements is visible. So if the parent element's content gets overflowed, they break out of the modal and that doesn't look good! So, you need to set the CSS overflow property to scroll or hidden to fix breaking on small size. Try adding:

.modal-content.ui-resizable {
  overflow: scroll;
}

This will ensure scrolling on overflow of the element.

Link to JSFiddle: https://jsfiddle.net/p7o2mkg4/1/

like image 65
Abraar Arique Diganto Avatar answered Oct 12 '22 01:10

Abraar Arique Diganto