jQueryUI dialog width

Posted by user35295 on Stack Overflow See other posts from Stack Overflow or by user35295
Published on 2014-05-24T17:06:48Z Indexed on 2014/05/28 21:27 UTC
Read the original article Hit count: 170

Filed under:
|
|
|

Fiddle Full Screen Example

I use jQuery dialog to open tables. Some of them have a large amount of text and they tend to be too long and go way off the screen. How can I make the dialog wider if the table is too long like the first one in the fiddle? I've tried width:'auto' but it seems to just occupy the entire screen.

HTML:

<button class='label'>Click</button><div class='dialog'><p><table>.....</table></div>
<button class='label'>Click</button><div class='dialog'><p><table>.....</table></div>

Javascript:

$(document).ready(function(){

 $('.label').each(function() {

 var dialogopen = $(this).next(".dialog"); 
 dialogopen.dialog({width:'auto',autoOpen: false,modal: true,
            open: function(){
            jQuery('.ui-widget-overlay').bind('click',function(){
                dialogopen.dialog('close');
            })
        }    
 });    
  $(this).click(function(){
        dialogopen.dialog('open');
         return false;
            }
        );
  });
});

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about html