How can I position my jQuery dialog to center?
The latest jQuery UI has a position component:
$("#myDialog").position({ my: "center", at: "center", of: window});
Doc: http://jqueryui.com/demos/position/
Get: http://jqueryui.com/download
I'm pretty sure you shouldn't need to set a position:
$("#dialog").dialog();
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.
$('.selector').dialog({ position: 'top' });
Get or set the position option, after init.
//gettervar position = $('.selector').dialog('option', 'position');//setter$('.selector').dialog('option', 'position', 'top');
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".
Because the dialog need a position, You need to include the js position
<script src="jquery.ui.position.js"></script>