EasyUI Forum

General Category => General Discussion => Topic started by: Alfred on November 11, 2019, 12:37:35 PM



Title: get dialog width and height when resize
Post by: Alfred on November 11, 2019, 12:37:35 PM
Is it possible to get the dialog width and height as we resize.


Code:
var d = $('#infp');//dialog selector
d.dialog('onResize',function(w,h){
   var newheight = h;
   var newwidth = w;
})

This does not work. This code is inside the dialog, which content is loaded remotely.

Thanks and regards,
Alfred


Title: Re: get dialog width and height when resize
Post by: jarry on November 11, 2019, 07:18:47 PM
Call 'options' method to retrieve the dialog's width and height.
Code:
var opts = $('#infp').dialog('options');
console.log(opts.width+":"+opts.height);


Title: Re: get dialog width and height when resize
Post by: Alfred on November 12, 2019, 09:00:16 AM
Thanks. This works fine

Code:
var dial = $('#infp');
dial.dialog('options').onResize = function(w,h){
//
}