简体   繁体   中英

Width doesn't change for the dialog box

I'm trying to modify a small alert/dialog box function but for some reason the width won't change from 350px ,which was its initial value.

I've tried to set a minWidth as well,I've permutated between the way the attributes where set,I've tried to put the width to 'auto',used different imports..even made setters and getters but nothing worked.

Here is the code

function randomAlertFunction(message,title){

 $d=$('<div></div>').dialog({
     modal:true,
     autoOpen:false,
     width:350,
     buttons: {
            Ok: function() {
                  $(this).dialog("close");
     }
}
});

  var title= title;
  $d.html(message);
  $d.dialog("option","title",title);
  $d.dialog('open');
  $d.focus();
}

Edit

I solved it by cleaning the cache of the browser!

I believe you are asking for changing the width after initialiasing dialogue.You can change it using:

1) You will need ui.resizable.js and ui.resizable.css for this.

$("#dialogBox").dialog('option','width',700);//new width

2) without ui.resizable.js and ui.resizable.css

 $("#dialogBox").data("width.dialog", 700);

or

 $("#dialogBox").css("width", 160);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM