Dialog is shown itself when changing size of not visible dialog
I have following code that is run every time user rotates mobile phone (so screen width and height are changed) to calculate proper width and height all widgets:
- $( "#dialog1" ).dialog({ height: Math.round(screen.availHeight * 0.7)});
- $( "#dialog1" ).dialog({ width: Math.round(screen.availWidth * 0.7) });
I noticed that after a few seconds dialog is shown but function
- $( "#dialog1" ).dialog("open");
is not called.
To prevent this I need to use following code
- $( "#dialog1" ).dialog({ height: Math.round(screen.availHeight * 0.7)});
- $( "#dialog1" ).dialog({ width: Math.round(screen.availWidth * 0.7) });
- if(! $("#dialog1").is(":visible")) {
- $( "#dialog1" ).dialog( "close" );
- }
Is this right that changing dialog properties makes it visible ?