I have tried following code, but it only positions dialogs left upper corner position to center, and that makes element to be aligned to right. How can I center dialog to real center which counts elements width, so that center line will cut dialog to 50% 50% halfs?
$('.selector').dialog({ position: 'center' });
I'm pretty sure you shouldn't need to set a position:
should center by default.
I did have a look at the article, and also checked what it says on the official jquery-ui site about positioning a dialog : and in it were discussed 2 states of: initialise and after initialise.
Code examples - (taken from jQuery UI 2009-12-03)
Initialize a dialog with the position option specified.
Get or set the position option, after init.
I think that if you were to remove the position attribute you would find it centers by itself else try the second setter option where you define 3 elements of "option" "position" and "center".
So if anyone hits this page like I did, or for when I forget in 15 minutes, I'm using jqueryui dialog version 1.10.1 and jquery 1.9.1 with ie8 in an iframe(blah), and it needs a within specified or it doesn't work, i.e.
Thanks to @vm370 for pointing me in the right direction.
Try this....
I have to call function
dialog()
twice to position the dialog (jQuery v1.11.2 / jQueryUI v1.10.4).Jquery UI 1.9.2
, jquery and the later versions don' support IE8I found two solutions for that.
Rollback to
jquery UI 1.7.2
to support IE8,Try this code with
Jquery UI 1.9.2
Another thing that can give you hell with JQuery Dialog positioning, especially for documents larger than the browser view port - you must add the declaration
At the top of your document.
Without it, jquery tends to put the dialog on the bottom of the page and errors may occur when trying to drag it.