How can you disable scroll bars in the jQuery UI dialog box?

94,558

Solution 1

Do you mean the jQuery UI dialog widget?

You can pass an option when you create it to specify its height, e.g.

$('.selector').dialog({ height: 350 });

Make it taller than the content you’re putting into it, and I suspect you’d be golden.

Solution 2

I solved the problem like this:

.dialog({
  title: $(this).attr("data-dialog-title"),
  closeOnEscape: true,
  close: function () { $(this).remove() },
  draggable: true,
  position: 'center',
  width: 500,
  height: 'auto',
  modal: true,
  open: function (event, ui) {
    $('#myDialogId').css('overflow', 'hidden'); //this line does the actual hiding
  }
});

Solution 3

The overflow:hidden worked for me. When only setting the height/width params the scroll bars would still appear depending on text size and zoom.

Solution 4

Solution with no css or fixed Height:

I think the best solution to above problem is to make dialog height dynamic, the height should adjust automatically as per content, when content increases modal height should increase. To do this use the height "auto" option provided by Jquery UI modal , it adjusts modal height as per content so need of add 'overflow:hidden' or 'height:350'

$( "#dialog" ).dialog({
modal : true,
height:"auto"

}); 

Solution 5

This removed the scroll bars:

$( "#dialog" ).dialog({
    autoOpen: false,
    resizable: false,
    dialogClass: 'info',
    height: 'auto',
    width: 'auto',
    show: { effect: "blind", duration: 1000 },
    hide: {effect: "explode", duration: 1000 },
    draggable: true,
    open: function (event, ui) {
        $(this).dialog('open');
    },
    close: function (event, ui) {
        cleanup() ;
    }
});
Share:
94,558
ngreenwood6
Author by

ngreenwood6

Updated on June 14, 2020

Comments

  • ngreenwood6
    ngreenwood6 almost 4 years

    Does anyone know if there is a way to disable scroll bars in the jquery dialog box? The content that I have in the div is 300 px but the dialog is set to 200px. It automatically puts the scrollbars but I do not want them. I will add it myself to the second div that makes it bigger than the window. Any help is appreciated.